Skip to main content

md_mermaid

This is a fork that we had to make to publish ObsidianHTML without the bug in the original md_mermaid package. The rest of this readme comes from there.

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

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)

Release files for obsidianhtml-md-mermaid-fork 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obsidianhtml-md-mermaid-fork 0.1.5
File Size Uploaded
obsidianhtml_md_mermaid_fork-0.1.5.tar.gz 15.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for obsidianhtml-md-mermaid-fork 0.1.5
File Interpreter ABI Platform
obsidianhtml_md_mermaid_fork-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 31.3 kB

Release files / obsidianhtml_md_mermaid_fork-0.1.5.tar.gz

Download URL obsidianhtml_md_mermaid_fork-0.1.5.tar.gz
Size 15.4 kB
Tags Source
SHA-256 checksum
How to use checksums
a8efdbd64342dd7c7e2fe2d34e1bbec03064dd0203a0a6edb8ded6fdd6e26f6d
BLAKE2b-256 checksum
How to use checksums
9dd99c12d6373f7df0f227b6afe20c719fec12a7b7846b0c10285c93b633bd86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release files / obsidianhtml_md_mermaid_fork-0.1.5-py3-none-any.whl

Download URL obsidianhtml_md_mermaid_fork-0.1.5-py3-none-any.whl
Size 15.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
76525abdd2a9e105095fd8e150a0e249def0ff2f6bf3b3c2644d14e7739f6d43
BLAKE2b-256 checksum
How to use checksums
f389fc2a8af40cd4cb7dc90e41818a831b9e2185b71988b544ee1769f3c5cfd8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page