Aller au contenu
Le blog de Pascal Andy - L'homme et les relations technologiques

Mermaid Diagram Demo

This post demonstrates the difference between rendering Mermaid diagrams and showing the raw code.

Raw Code (will NOT render)

Use text as the language identifier to show the code:

graph TD
    A[Start] --> B[Process]
    B --> C{Decision}
    C -->|Yes| D[Action]
    C -->|No| E[End]

Rendered Diagram

Set mermaid: true in the post frontmatter, then use mermaid as the code block language. The browser loads Mermaid from cdn.jsdelivr.net. If the CDN is unavailable, the reader sees the original diagram source. Without the flag, the block stays as code:

graph TD
    A[Start] --> B[Process]
    B --> C{Decision}
    C -->|Yes| D[Action]
    C -->|No| E[End]

Mermaid diagram rendered in the browser

Another Example: Sequence Diagram

Raw code:

sequenceDiagram
    Alice->>Bob: Hello Bob!
    Bob-->>Alice: Hi Alice!

Rendered:

sequenceDiagram
    Alice->>Bob: Hello Bob!
    Bob-->>Alice: Hi Alice!

Summary

Language IdentifierResult
mermaidDiagram, or source while offline
textShows raw code
plaintextShows raw code
(none)Shows raw code