Skip to main content

Render Mermaid diagrams from Python — no Node.js required

Project description

mermaido

Render Mermaid diagrams from Python — no Node.js required.

mermaido bundles Node.js via nodejs-bin and wraps mermaid-cli so you can generate diagrams without managing any JavaScript tooling yourself.

Install

pip install mermaido
mermaido install

or with uv:

uv add mermaido
uv run mermaido install

The mermaido install step downloads mermaid-cli and Chromium (~200 MB) into a local cache. You only need to run it once.

Python API

import mermaido

# Render to a file
mermaido.render("graph TD; A-->B;", "output.png")
mermaido.render("graph TD; A-->B;", "output.svg", fmt="svg")

# Render to a string
svg = mermaido.render_to_string("graph TD; A-->B;")

CLI

mermaido is a drop-in replacement for mmdc:

mermaido -i diagram.mmd -o output.svg
mermaido -i diagram.mmd -o output.png -t dark
mermaido --help

Configuration

Environment variable Default Description
MERMAIDO_MMDC_VERSION 11.4.2 mermaid-cli version to install

How it works

  1. pip install mermaido installs the Python package and a bundled Node.js binary (via nodejs-bin).
  2. mermaido install uses that bundled Node.js to npm install mermaid-cli and Chromium into a cache directory (~/.cache/mermaido on Linux, platform-appropriate elsewhere).
  3. mermaido.render() or the mermaido CLI invokes mmdc from that cache.

No system-wide Node.js or npm installation is needed.

License

MIT

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

mermaido-0.1.0.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mermaido-0.1.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file mermaido-0.1.0.tar.gz.

File metadata

  • Download URL: mermaido-0.1.0.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mermaido-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f774dd8d422bebc845aa3c62d57376de1cc0f2dc310ebeea34fa76f92640d5b5
MD5 a648515f3a3529636f2a5f951e4060f4
BLAKE2b-256 adc3d33f8ed091e1e0f3e644940805729d8c9713cad3dbd2bafaff53bee073d9

See more details on using hashes here.

Provenance

The following attestation bundles were made for mermaido-0.1.0.tar.gz:

Publisher: publish.yml on stano45/mermaido

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mermaido-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: mermaido-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for mermaido-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 620d209d23da0c048bfb0f860e8beb8c27e0bab11321ea896f8f28b979c27b18
MD5 c4bfa3bf44dbac77ac8df0acef84cb4d
BLAKE2b-256 8834d332f3eaf7e59a64301eaf4518280c4957c5607507d31c7af739d6a4feaf

See more details on using hashes here.

Provenance

The following attestation bundles were made for mermaido-0.1.0-py3-none-any.whl:

Publisher: publish.yml on stano45/mermaido

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page