Diagram
Renders diagrams from code blocks using Mermaid.js. The code block content is rendered as an SVG diagram in the browser.
Basic usage
Wrap a Mermaid code block with the diagram rune to render it as an SVG.
{% diagram language="mermaid" title="User Authentication Flow" %}
```mermaid
graph TD
A[Visit Site] --> B{Logged In?}
B -->|Yes| C[Dashboard]
B -->|No| D[Login Page]
D --> E[Sign Up]
D --> F[Sign In]
F --> C
E --> C
```
{% /diagram %}<figure data-rune="diagram">
<meta content="mermaid" data-field="language">
<meta content="User Authentication Flow" data-field="title">
<meta content="graph TD
A[Visit Site] --> B{Logged In?}
B -->|Yes| C[Dashboard]
B -->|No| D[Login Page]
D --> E[Sign Up]
D --> F[Sign In]
F --> C
E --> C
" data-name="source">
</figure>graph TD
A[Visit Site] --> B{Logged In?}
B -->|Yes| C[Dashboard]
B -->|No| D[Login Page]
D --> E[Sign Up]
D --> F[Sign In]
F --> C
E --> C
<rf-diagram class="rf-diagram" data-rune="diagram" data-density="compact" data-language="mermaid">
<figcaption class="rf-diagram__title">User Authentication Flow</figcaption>
<div class="rf-diagram__container">
<pre class="rf-diagram__source"><code>graph TD
A[Visit Site] --> B{Logged In?}
B -->|Yes| C[Dashboard]
B -->|No| D[Login Page]
D --> E[Sign Up]
D --> F[Sign In]
F --> C
E --> C
</code></pre>
</div>
<div data-content="source" style="display:none">graph TD
A[Visit Site] --> B{Logged In?}
B -->|Yes| C[Dashboard]
B -->|No| D[Login Page]
D --> E[Sign Up]
D --> F[Sign In]
F --> C
E --> C
</div>
</rf-diagram>Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
language | string | mermaid | Diagram language: mermaid, plantuml, or ascii |
title | string | — | Accessible title for the diagram |
Common attributes
All block runes share these attributes for layout and theming.
| Attribute | Type | Default | Description |
|---|---|---|---|
width | string | content | Page grid width: content, wide, or full |
spacing | string | — | Vertical spacing: flush, tight, default, loose, or breathe |
inset | string | — | Horizontal padding: flush, tight, default, loose, or breathe |
tint | string | — | Named colour tint from theme configuration |
tint-mode | string | auto | Colour scheme override: auto, dark, or light |
bg | string | — | Named background preset from theme configuration |