Python-Markdown extension to add Mermaid graph
Project description
markdown-mermaidjs
Python-Markdown extension to add Mermaid graph
Getting Started
Prerequisites
Installation
For pip
installation (only python version >=3.x) :
pip install markdown-mermaidjs
Usage
With 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=["markdown-mermaidjs"])
print(html)
Expected output
<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 type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
</script>
Use it with Pelican
Add "markdown_mermaidjs": {}
to MARKDOWN["extension_configs"]
in your pelicanconf.py
MARKDOWN = {
"extension_configs": {
"markdown_mermaidjs": {},
},
}
Contributing
See Contributing
Authors
Wei Lee weilee.rx@gmail.com
This is a forked project of oruelle/md_mermaid
Created from Lee-W/cookiecutter-python-template version 1.10.1
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
markdown_mermaidjs-1.0.0.tar.gz
(84.3 kB
view hashes)
Built Distribution
Close
Hashes for markdown_mermaidjs-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bfd594da8ba43707fc6f099111da3b218c8b5a12cec97d59cf490c8772c8a6a |
|
MD5 | ad8f180a90193b89cee8060666a2886b |
|
BLAKE2b-256 | 139b7a4f8fafc0d19275c2d6b7f3d1b23c20a7f14e9ebecc86935776fd1b15ed |