Skip to main content

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)

Development

Build and publish a new version on pypi

  • Increment the version in setup.py
  • Build the package:
python3 setup.py sdist bdist_wheel
  • Upload the packages on pypi:
python3 -m twine upload --repository pypi dist/*
  • Commit, tag the commit with the version number, and push all that

For the twine upload to work, it needs a ~/.pypirc file declaring the pypi repository:

[pypi]                                                                                                                                                                                                                                        
  username = __token__
  password = pypi-<AN_ALLOWED_PYPI_TOKEN>

Metadata

Release files for md-mermaid-ort 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 md-mermaid-ort 0.1.5
File Size Uploaded Provenance Actions
md-mermaid-ort-0.1.5.tar.gz 3.3 kB Without provenance Details for md-mermaid-ort-0.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 19.1 kB

Release files / md-mermaid-ort-0.1.5.tar.gz

Download URL md-mermaid-ort-0.1.5.tar.gz
Size 3.3 kB
Tags Source
SHA-256 checksum
How to use checksums
8becd7c9ccfe4b0c3f78b8f9ff3ce5231b778908165e2f62f3233c54eb40fb20
BLAKE2b-256 checksum
How to use checksums
5cde9bdad4407116210fbd41b2b6312898163a7e7e5c1271b77260150bddb49f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9

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

Download URL md_mermaid_ort-0.1.5-py3-none-any.whl
Size 15.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0be9760c95f5ade1975bc20021f517d55809fd21d6d59d0ea13cfe453a474a94
BLAKE2b-256 checksum
How to use checksums
cbe7b6c07fb0e0087b0c1ca869bb6ea92fb8089831c896ec5a374ffd476682a4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.6.9

Security for md-mermaid-ort 0.1.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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