Skip to content

Mermaid Diagram

Mermaid is a text-based diagram tool for Markdown. In Firefly, Mermaid diagrams are rendered as static SVG at build time using merman, without a client-side Mermaid runtime.

Config File

src/config/mermaidConfig.ts

PropertyTypeDefaultDescription
lightThemestring"editor-light"Theme used in light mode
darkThemestring"editor-dark"Theme used in dark mode
ts
export const mermaidConfig: MermaidConfig = {
  lightTheme: "editor-light",
  darkTheme: "editor-dark",
};

Available Themes

Light themes: editor-light, gruvbox-light, ayu-light

Dark themes: editor-dark, one-dark, gruvbox-dark, ayu-dark

Usage

Use a mermaid fenced code block directly in posts:

md
```mermaid
graph TD
  A[Start] --> B{Condition}
  B -->|Yes| C[Continue]
  B -->|No| D[End]
```

Supported Diagram Types

TypeSyntax
Flowchartgraph TD / graph LR / flowchart
Sequence DiagramsequenceDiagram
Class DiagramclassDiagram
State DiagramstateDiagram-v2
ER DiagramerDiagram
XY Chartxychart-beta
Gantt Chartgantt
Pie Chartpie
Mindmapmindmap
Timelinetimeline
User Journeyjourney
Git GraphgitGraph
Kanbankanban
Sankey Diagramsankey-beta
Architecture Diagramarchitecture-beta
C4, Requirement, Radar, Treemap, and moreCorresponding Mermaid syntax

WARNING

Firefly currently pins @mermanjs/web@0.8.0-alpha.3. Merman is still in alpha; refer to its alignment status for current compatibility details.

Notes

  • Diagrams are rendered as static SVG through WASM during the Astro build, with no CDN or client-side Mermaid JS.
  • Light and dark SVGs are generated simultaneously; CSS automatically switches based on the current theme.
  • If rendering fails, the build log shows the error details and the page displays a fallback with the original code.
  • Pan-zoom and fullscreen controls are provided by a shared plugin (also used by PlantUML).

See also: PlantUML Diagram

See merman for more details.