Super-Markdown
a Python library to export a complex Markdown file into a standalone HTML file.
It will include:
- Mermaid.js to create diagrams with javascript
- graphviz to create Diagrams in Dot language
- Markdown-TOC to create Table of Content
- markdown-checklist to support create Checklists
- Github Flavoured MarkdownStylesheet
Instalation
Old School
git clone https://github.com/madeindjs/super-markdown.git
cd super-markdown
python setup.py install
New School
pip install supermarkdown
Usage
Command line usage
- export one markdown file in one Html file
super-markdown -f README.md
- export many markdown files in one Html file
super-markdown -d /home/alex/markdown_files/
additional options
- Choose the name of the output file
super-markdown -d /home/alex/markdown_files/ -o my_concatenated_file.html
- Prevent the browser from opening
super-markdown -d /home/alex/markdown_files/ -no_browser
API usage
Hello World
from SuperMarkdown import SuperMarkdown
supermd = SuperMarkdown()
content = "# Hello World\r\n"
content += "[SuperMarkdown](https://github.com/madeindjs/Super-Markdown) is awesome!"
supermd.add_content(text=content)
supermd.export()
# Additional options
supermd.export_url = 'my_export_url.html' # to change the export filename
supermd.open_browser = False # to deactivate browser opening
Table of Content
Addsupermd.add_TOC(text=content)
content = "## Other title\r\n## Other title\r\n###sutitle\r\n## Other title"
supermd.add_content(text=content)
supermd.export()
Dot Graph
Adddotgraph = """```dotgraph
digraph "pet-shop" {
graph [rankdir=LR]
node [shape=plaintext]
edge [arrowhead=vee arrowsize=2]
parrot
dead
parrot -> dead
}
```"""
supermd.add_content(text=dotgraph)
supermd.export()
Convert markdown file(s)
one file
supermd = SuperMarkdown()
supermd.add_content('/home/alex/markdown_files/a_file.md')
supermd.export()
many files
files = os.listdir('/home/alex/markdown_files/')
supermd = SuperMarkdown()
supermd.add_content(*files)
supermd.export()
Syntax
Table of content
To create a Table of content you just need to insert [TOC]
in your markdown file
Markdown
Mermaid.js
Dot Language
Requirements
First you need to install graphviz on your computer
Then you need to install these python librairy
You can do it quickly with this command pip install -r requirements.txt