Skip to main content

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.

flowchart LR
    a --> b
:::

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinx_gp_mermaid-0.0.1a32.tar.gz (70.5 kB view details)

Uploaded Source

Built Distribution

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

sphinx_gp_mermaid-0.0.1a32-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_gp_mermaid-0.0.1a32.tar.gz.

File metadata

  • Download URL: sphinx_gp_mermaid-0.0.1a32.tar.gz
  • Upload date:
  • Size: 70.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sphinx_gp_mermaid-0.0.1a32.tar.gz
Algorithm Hash digest
SHA256 01e035add8e998daf25a433146ef57854a955c0b39219f4a71b1ac9cc9d1c84e
MD5 cd876f7de4fccde67a87982322fc3e87
BLAKE2b-256 c0e83397aecb017a8beab4f13122ed6e961cc0b96eb3a0b5bb9535f7a533b741

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_gp_mermaid-0.0.1a32.tar.gz:

Publisher: release.yml on git-pull/gp-sphinx

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

File details

Details for the file sphinx_gp_mermaid-0.0.1a32-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_gp_mermaid-0.0.1a32-py3-none-any.whl
Algorithm Hash digest
SHA256 6ffefab4bac2b77dc726aff6c5f7ec53a4fba58152c0cd2fa6505a80b0846d07
MD5 f35d5c6a6b8c658363939493c8deeecc
BLAKE2b-256 6a469ecc34f7e39c235653907e3dd5a26ba72926e6e2caaad7decd7f4f7f314c

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_gp_mermaid-0.0.1a32-py3-none-any.whl:

Publisher: release.yml on git-pull/gp-sphinx

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