Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mdutils/tools/MDList.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def _add_new_item(self, item: str, marker: str):
def _is_there_marker_in_item(cls, item: str) -> bool:
if (
item.startswith("-")
or item.startswith("*")
or item.startswith("*") and not item.startswith("**")
or item.startswith("+")
or re.search(r"^(\d\.)", item)
):
Expand Down
35 changes: 35 additions & 0 deletions tests/test_mdutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,34 @@ def setUp(self) -> None:
],
"Item 5",
]
self.expected_bold_list = (
"\n\n\n"
"\n- **Item 1**\n"
"- **Item 2**\n"
"- **Item 3**\n"
"- **Item 4**\n"
" - **Item 4.1**\n"
" - **Item 4.2**\n"
" - **Item 4.2.1**\n"
" - **Item 4.2.2**\n"
" - **Item 4.3**\n"
" - **Item 4.3.1**\n"
"- **Item 5**\n"
)
self.complex_bold_items = [
"**Item 1**",
"**Item 2**",
"**Item 3**",
"**Item 4**",
[
"**Item 4.1**",
"**Item 4.2**",
["**Item 4.2.1**", "**Item 4.2.2**"],
"**Item 4.3**",
["**Item 4.3.1**"],
],
"**Item 5**",
]

def tearDown(self):
md_file = Path("Test_file.md")
Expand Down Expand Up @@ -486,6 +514,13 @@ def test_new_list(self):
md_file.create_md_file()

self.assertEqual(self.expected_list, MarkDownFile.read_file("Test_file.md"))

def test_new_list_bold_items(self):
md_file = MdUtils(file_name="Test_file", title="")
md_file.new_list(self.complex_bold_items)
md_file.create_md_file()

self.assertEqual(self.expected_bold_list, MarkDownFile.read_file("Test_file.md"))

def test_new_checkbox_list(self):
md_file = MdUtils(file_name="Test_file", title="")
Expand Down