maket_mermaid
Render Mermaid syntax into inline SVG diagrams embedded in your page. Supports flowcharts, sequence, class, ER, state, and XY charts with in-place replacement for existing diagrams.
Instructions
When to use: add a diagram to a page. Works for flowcharts, sequence, class, ER, state, and XY chart diagrams. Pick this over manual SVG or nested divs when the thing you want is conceptually a graph.
Renders Mermaid syntax to durable inline SVG and injects it into the page HTML. The source and semantic rendering choices stay on the wrapper so charte changes can rerender the diagram. The diagram scales with its wrapper (width/height drive the frame, not the SVG itself). If dataId already exists, the diagram is replaced in place — idempotent edits. A document charte is applied automatically through canonical diagram tokens and documented color/font fallbacks. tokenRefs selects any existing charte token explicitly; direct safe values take final precedence. Density controls are supported for flowchart and state diagrams by the current renderer. Source-level Mermaid styling directives are rejected; use charte tokens or safe diagram options. Header on its own line: graph TD\n A-->B (NOT graph TD; A-->B)
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| bg | No | Safe background colour. Overrides charte, profile, or tokenRefs. | |
| fg | No | Safe foreground colour. Overrides charte, profile, or tokenRefs. | |
| doc | Yes | Document name | |
| code | Yes | Mermaid diagram syntax. Header on its own line, then statements. E.g. "graph TD\n A-->B\n B-->C". | |
| font | No | Safe primary font family. A fallback stack is normalized to its first family. Overrides charte, profile, or tokenRefs. | |
| line | No | Safe connector colour. Overrides charte, profile, or tokenRefs. | |
| page | Yes | Page number (1-based) | |
| muted | No | Secondary text colour. Overrides charte, profile, or tokenRefs. | |
| theme | No | Optional built-in diagram profile. Overrides automatic charte defaults; tokenRefs and direct values override it. | |
| width | No | CSS width for the wrapper (e.g. "180mm", "100%"). Default: auto. | |
| accent | No | Safe arrow/accent colour. Overrides charte, profile, or tokenRefs. | |
| border | No | Node and group border colour. Overrides charte, profile, or tokenRefs. | |
| dataId | No | data-id for the wrapper element. Default: auto-generated (mermaid-1, mermaid-2...) | |
| height | No | CSS height for the wrapper (e.g. "120mm"). Default: auto. | |
| padding | No | Flowchart/state canvas padding in px. | |
| surface | No | Node surface colour. Overrides charte, profile, or tokenRefs. | |
| position | No | Where to insert relative to target. Default: beforeend. | |
| targetId | No | data-id of parent element to insert into. Default: page root. | |
| tokenRefs | No | Explicit references to tokens on the document charte, keyed by diagram role. Example: {"bg":"color.paper","accent":"color.primary","font":"font.body"}. | |
| nodeSpacing | No | Flowchart/state horizontal spacing between sibling nodes in px. | |
| transparent | No | Render without an SVG background. Default: false. | |
| layerSpacing | No | Flowchart/state vertical spacing between diagram layers in px. |