sphinxcontrib-mermaid
Mermaid diagrams in your Sphinx-powered docs
What it is and what it does
sphinxcontrib-mermaid is a Sphinx extension that lets you write Mermaid diagram syntax directly in your reStructuredText or Markdown documentation and have them render as interactive diagrams in the final HTML output. It integrates with Sphinx's build pipeline and depends on Jinja2, PyYAML, and Sphinx itself to process and embed the diagrams.
The extension is useful when you want to include flowcharts, sequence diagrams, Gantt charts, and other visual representations in technical documentation without manually creating image files. You write the diagram definition in plain text using Mermaid's syntax, and the extension handles conversion to rendered graphics during the Sphinx build.
Use it for:
- Add flowcharts and process diagrams to API documentation or architecture guides.
- Include sequence diagrams in technical specifications or protocol documentation.
- Embed Gantt charts in project planning or timeline documentation.
- Create state machine diagrams for explaining system behavior or workflows.
- Build interactive diagrams that render consistently across all documentation builds.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Embeds Mermaid diagrams (flowcharts, sequence diagrams, Gantt charts, and more) directly into Sphinx-generated documentation.
Yes. The package is actively maintained, has low install friction, carries no known vulnerabilities, uses a permissive license, and solves a clear documentation need. It is well-suited for any Sphinx-based project that benefits from embedded diagrams. Install it if you are using Sphinx and want to include Mermaid diagrams without managing separate image files.
Install
sphinxcontrib-mermaid on PyPI
pip
pip install sphinxcontrib-mermaiduv
uv add sphinxcontrib-mermaidpoetry
poetry add sphinxcontrib-mermaidInstalling sphinxcontrib-mermaid
Before you install
Low install friction with three straightforward runtime dependencies. Actively maintained with a recent release 27 days ago and ongoing commits; the repository has 409 stars and is not archived.
License in practice
BSD-2-Clause is permissive, allowing commercial and private use with minimal restrictions beyond retaining the license notice.
Quickstart
pip install sphinxcontrib-mermaid
# In conf.py:
extensions = ['sphinxcontrib.mermaid']
# In your .rst file:
.. mermaid::
graph LR
A --> B
Requires Python 3.10 or later; Sphinx must be installed and configured in your documentation project.
Verify before relying
- Whether Mermaid JavaScript library is automatically bundled or requires separate installation in the build environment.
- Support for all Mermaid diagram types (e.g., state diagrams, class diagrams, entity-relationship diagrams) beyond those mentioned in the description.
Package facts
| License | BSD-2-Clause (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — jinja2, pyyaml, sphinx |
| Maintenance | actively maintained — 27 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 6,384,596/month — #1,918 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sphinxcontrib_mermaid-2.1.0-py3-none-any.whl
Keywords: diagrams, documentation, mermaid, sphinx
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
mermaid-pymermaid-py provides a Python interface to the…
permissive · top 15,000 on PyPI
mkdocs-mermaid2-pluginA MkDocs plugin that renders Mermaid diagram…
permissive · top 5,000 on PyPI
sphinxcontrib-blockdiagA Sphinx extension that embeds block diagrams…
permissive · top 15,000 on PyPI
paracelsusParacelsus generates Entity Relationship…
permissive · top 15,000 on PyPI
mermaid-builderProgrammatically generates MermaidJS diagram…
permissive · top 15,000 on PyPI
django-diagramGenerates Entity Relationship Diagrams in…
unclear · top 15,000 on PyPI
mkdocs-panzoom-pluginAdds interactive pan and zoom functionality to…
permissive · top 5,000 on PyPI
sphinxcontrib-plantumlAdds PlantUML diagram rendering to Sphinx…
permissive · top 15,000 on PyPI
sphinx-commentsIntegrates third-party commenting and…
permissive · top 15,000 on PyPI
sphinx-plotly-directiveAdds a Sphinx directive to embed interactive…
unclear · top 15,000 on PyPI