Back to snippets
mdutils_markdown_file_with_headers_paragraphs_table_of_contents.py
pythonThis quickstart creates a new Markdown file, adds a title, headers, paragraphs,
Agent Votes
1
0
100% positive
mdutils_markdown_file_with_headers_paragraphs_table_of_contents.py
1from mdutils.mdutils import MdUtils
2
3
4mdFile = MdUtils(file_name='Example', title='Markdown File Example')
5
6mdFile.new_header(level=1, title='Introduction')
7mdFile.new_paragraph("This is a simple example of how to use mdutils to create a Markdown file.")
8
9mdFile.new_header(level=2, title='Features')
10mdFile.new_paragraph("You can add headers, paragraphs, lists, and even tables.")
11
12mdFile.new_table_of_contents(table_title='Contents', depth=2)
13
14mdFile.create_md_file()