Build-time Mermaid diagrams for Sphinx — dual light/dark inline SVG rendered via mermaid-cli
Project description
sphinx-gp-mermaid
Build-time Mermaid diagrams for Sphinx. Fenced mermaid blocks render to
inline <svg> during the build via mmdc
(@mermaid-js/mermaid-cli):
no client-side mermaid runtime, no asynchronous pop-in, no layout shift.
Each diagram is rendered twice — a light and a dark variant — and both are
inlined, toggled by CSS on body[data-theme]. Diagrams paint with the page,
follow the theme toggle without JavaScript, and survive SPA navigation as
live DOM.
Install
$ pip install sphinx-gp-mermaid
Usage
Enable the extension in conf.py:
extensions = ["sphinx_gp_mermaid"]
With gp-sphinx, opt in via merge_sphinx_config:
config = merge_sphinx_config(
extra_extensions=["sphinx_gp_mermaid"],
)
Author diagrams as MyST fences:
:::{mermaid}
:caption: How it flows.
:alt: a request flowing through two steps
:name: request-flow
:responsive: fit
flowchart LR
a --> b
:::
fit is the default responsive policy: the rendered SVG scales down to the
content column. Use :responsive: preserve when a dense diagram should keep
its intrinsic width and scroll horizontally instead of shrinking labels.
Renderer toolchain
Rendering shells out to mmdc, resolved from the mermaid_cmd config value,
then <confdir>/node_modules/.bin/mmdc, then PATH. Install it in the docs
toolchain:
$ pnpm add -D @mermaid-js/mermaid-cli
When the renderer is unavailable the build still succeeds: diagrams degrade to their source text with a single warning.
Documentation
See the full documentation for directive options, theming, caching, and CI setup.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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
File details
Details for the file sphinx_gp_mermaid-0.0.1a33.tar.gz.
File metadata
- Download URL: sphinx_gp_mermaid-0.0.1a33.tar.gz
- Upload date:
- Size: 71.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
569541543f4a7e9aa26c935718162da438f63268b48db32a3d3d48a1b6ec0697
|
|
| MD5 |
99465444eed41e7bdfbca51917eee735
|
|
| BLAKE2b-256 |
841e70bfe4ac964dd6a99399c6bf534fbf7ba555e78362bbefbc0e354c4c47c8
|
Provenance
The following attestation bundles were made for sphinx_gp_mermaid-0.0.1a33.tar.gz:
Publisher:
release.yml on git-pull/gp-sphinx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_gp_mermaid-0.0.1a33.tar.gz -
Subject digest:
569541543f4a7e9aa26c935718162da438f63268b48db32a3d3d48a1b6ec0697 - Sigstore transparency entry: 2082978212
- Sigstore integration time:
-
Permalink:
git-pull/gp-sphinx@2e91886e6e6b15a35853b9e2597e04150bf583e2 -
Branch / Tag:
refs/tags/v0.0.1a33 - Owner: https://github.com/git-pull
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2e91886e6e6b15a35853b9e2597e04150bf583e2 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinx_gp_mermaid-0.0.1a33-py3-none-any.whl.
File metadata
- Download URL: sphinx_gp_mermaid-0.0.1a33-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d520f808ed308eb469f7cacd8c79348334f23e1a5bec05bcfdc63aa932efb8f8
|
|
| MD5 |
00738d90128755188a037b4cbd044668
|
|
| BLAKE2b-256 |
d2fb871bc7600222d93a270add236c80f9b8b6460f7a5c81fccde5801e6708c7
|
Provenance
The following attestation bundles were made for sphinx_gp_mermaid-0.0.1a33-py3-none-any.whl:
Publisher:
release.yml on git-pull/gp-sphinx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_gp_mermaid-0.0.1a33-py3-none-any.whl -
Subject digest:
d520f808ed308eb469f7cacd8c79348334f23e1a5bec05bcfdc63aa932efb8f8 - Sigstore transparency entry: 2082984289
- Sigstore integration time:
-
Permalink:
git-pull/gp-sphinx@2e91886e6e6b15a35853b9e2597e04150bf583e2 -
Branch / Tag:
refs/tags/v0.0.1a33 - Owner: https://github.com/git-pull
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@2e91886e6e6b15a35853b9e2597e04150bf583e2 -
Trigger Event:
push
-
Statement type: