Pure Python Mermaid diagram renderer
Project description
merm
Pure Python Mermaid diagram renderer. Converts Mermaid markup to SVG with zero JavaScript dependencies.
Install
pip install merm
Usage
Command line
# File to file
merm -i diagram.mmd -o diagram.svg
# Pipe
echo 'graph LR
A --> B --> C' | merm > diagram.svg
# With uvx (no install needed)
uvx merm -i diagram.mmd -o diagram.svg
Python API
from merm import render_diagram
svg = render_diagram("""
flowchart TD
A[Start] --> B{Decision}
B -->|Yes| C[OK]
B -->|No| D[End]
""")
Supported diagram types
- Flowchart (
graph/flowchart) — all directions (TD, LR, BT, RL), subgraphs, shapes, edge labels - Sequence (
sequenceDiagram) — participants, messages, loops, alt/opt/par fragments - Class (
classDiagram) — classes, methods, attributes, relationships - State (
stateDiagram) — states, transitions, composite states, forks/joins
Features
- Pure Python — no Node.js, no browser, no Puppeteer
- Fast — ~200x faster than mermaid-cli (mmdc)
- SVG output with clean markup
- All flowchart shapes and edge types
- Subgraph nesting and styling
- Edge labels and arrow markers
Performance
Benchmarked against mermaid-cli (mmdc) across 28 scenarios:
| merm | mmdc | |
|---|---|---|
| Average render time | ~1 ms | ~200 ms |
| Dependencies | 0 | Node.js + Puppeteer |
| Startup overhead | None | ~500 ms |
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
merm-0.1.0.tar.gz
(2.4 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
merm-0.1.0-py3-none-any.whl
(139.9 kB
view details)
File details
Details for the file merm-0.1.0.tar.gz.
File metadata
- Download URL: merm-0.1.0.tar.gz
- Upload date:
- Size: 2.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9db9007f5ecbfb537d2599462312bbd5d1a12fa900b62e04992bb828526f5e79
|
|
| MD5 |
cd554a55872463c464d5da9ca48e0469
|
|
| BLAKE2b-256 |
eeab210ae675d1e41c8389a492480a092025726724085ddce686b3060357b9c8
|
File details
Details for the file merm-0.1.0-py3-none-any.whl.
File metadata
- Download URL: merm-0.1.0-py3-none-any.whl
- Upload date:
- Size: 139.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.16.5 cpython/3.13.12 HTTPX/0.28.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef44d0eadf49a9c8eaea4e3b4f924b55958de698b9fb49399f3697c6fa2b0612
|
|
| MD5 |
1862cb7875b94b6fe4eabeddb3c0a34e
|
|
| BLAKE2b-256 |
e674287f47542fef65578ba6036ed2caa40b8652faca014bde2ee9855afce701
|