-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers
Description
Describe the bug
Cannot create a file with a single header at level 2 (without having a level 1)
To Reproduce
from mdutils.mdutils import MdUtils
mdFile = MdUtils(file_name='example.md',title='Markdown File Example')
mdFile.new_header(level=2, title='Atx Header 2')
mdFile.create_md_file()
Expected behavior
Markdown file with a level 2 header
Desktop (please complete the following information):
- OS: macOS
- Version: Python 3.8, mdutils installed throurgh pip
Additional context
Traceback:
Traceback (most recent call last):
File "test-mdutils.py", line 4, in <module>
mdFile.new_header(level=2, title='Atx Header 2')
File "/opt/anaconda3/lib/python3.8/site-packages/mdutils/mdutils.py", line 113, in new_header
self.__add_new_item_table_of_content(level, title)
File "/opt/anaconda3/lib/python3.8/site-packages/mdutils/mdutils.py", line 130, in __add_new_item_table_of_content
curr = curr[-1]
IndexError: list index out of range
GoodmanBen, ustymhentosh, mp0023 and richbalmervishaalkk
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomers