Mini Blog

Diagrams with Mermaid

Mini supports diagrams via Mermaid — a JavaScript library for rendering diagrams from text definitions. Like KaTeX, Mermaid is only loaded on pages that need it.

Enable diagrams per-page with mermaid = true in front matter, then use the {{< mermaid >}} shortcode.

Flowchart

graph TD
    A[Write content] --> B{Need diagrams?}
    B -->|Yes| C[Add mermaid = true]
    C --> D[Use mermaid shortcode]
    D --> E[Build with Hugo]
    B -->|No| E
    E --> F[Publish]

Sequence Diagram

sequenceDiagram
    participant U as User
    participant B as Browser
    participant S as Hugo Server

    U->>B: Open page
    B->>S: GET /blog/
    S->>B: HTML + CSS
    B->>U: Rendered page
    U->>B: Toggle dark mode
    B->>B: Update theme
How the browser loads an article and applies a theme change.

Gantt Chart

gantt
    title Blog Setup Timeline
    dateFormat  YYYY-MM-DD
    section Setup
    Install Hugo        :done, 2026-01-01, 1d
    Choose theme        :done, 2026-01-02, 1d
    section Content
    Write first post    :done, 2026-01-03, 3d
    Add i18n            :active, 2026-01-06, 2d
    section Launch
    Deploy              :2026-01-08, 1d

Pie Chart

pie title What Makes a Good Blog Theme
    "Typography" : 35
    "Speed" : 25
    "Simplicity" : 25
    "Features" : 15

Front Matter

+++
title = "My Post with Diagrams"
mermaid = true
+++

The browser prioritizes nearby diagrams, then prepares the remaining diagrams and neutral print copies during idle time. Screen colors follow the light or dark theme. Hugo emits the source, not the diagram image. A local ESM bundle is supported; without JavaScript or after a loading failure, the source remains readable.

Printing uses the prepared copy; if it is not ready, the readable source is printed instead.