Menu

Documentation navigation

Diagrams

Render Mermaid diagrams at build time as static SVG — no JavaScript.

Typereference

Mermaid fenced blocks are rendered to SVG at build time by the diagram pipeline, so published pages contain plain images and stay JavaScript-free.

Diagram

The pipeline hashes each block’s source, writes the SVG under assets/diagrams/, and caches by hash — unchanged diagrams are never re-rendered.

# Running the pipeline

npm run diagrams   # rendered by build, check, and test automatically

A block whose diagram has not been rendered yet falls back to a plain code block, so builds never break while you draft. Set params.docs.mermaid.enforce = true to turn the fallback into a build warning (which fails --panicOnWarning CI builds).

# Captions and alt text

Flowchart of the diagram pipeline
Diagram pipeline

Fenced-code attributes set the title (figcaption) and alt text; the title is also used as alt text when alt is absent.

# Dark mode

The pipeline writes one SVG per theme (<hash>.svg for light, <hash>.dark.svg for dark). The render hook emits both images and CSS swaps them with the theme switcher and the OS preference — no JavaScript involved.

On this page