Fork of original md_mermaid by Olivier Ruelle, including some fixes with PR awaiting on the upstream
Project description
md_mermaid
mermaid extension for Python-Markdown to add support for mermaid graph inside markdown file
Installation
For pip
installation (only python version >=3.x) :
pip install markdown
pip install md-mermaid-ort
Usage
In your python script :
import markdown
text = """
# Title
Some text.
~~~mermaid
graph TB
A --> B
B --> C
~~~
Some other text.
~~~mermaid
graph TB
D --> E
E --> F
~~~
"""
html = markdown.markdown(text, extensions=['md_mermaid'])
print(html)
Output will result in :
<h1>Title</h1>
<p>Some text.</p>
<div class="mermaid">
graph TB
A --> B
B --> C
</div>
<p>Some other text.</p>
<div class="mermaid">
graph TB
D --> E
E --> F
</div>
<script>mermaid.initialize({startOnLoad:true});</script>
The <script>...</script>
line appears only once even if there are several graphs in the file.
Note that the extension name have a '_' not a '-'.
Attention : don't forget to include in your output html project the two following mermaid files :
- mermaid.css (optional, can be customised)
- mermaid.min.js (can be download here here)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
md-mermaid-ort-0.1.3.tar.gz
(2.0 kB
view hashes)
Built Distribution
Close
Hashes for md_mermaid_ort-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a538b321e9438bbbea3d88f9a3fe7cfdeca42df1a326c0181da430c4ccc00bb |
|
MD5 | 03473c349f734dc177acd6a8d96b7f4c |
|
BLAKE2b-256 | 275c70e746d39274bc6d4a9320f530b0ce50e0f99163c0cadaba94ed3f555dbf |