Skip to main content
  1. PaperMod/
  2. Samples/

Mermaid Diagrams in Hugo

2 mins·
Mermaid Diagrams Markdown
Milav Dabgar
Author
Milav Dabgar
Experienced lecturer in the electrical and electronic manufacturing industry. Skilled in Embedded Systems, Image Processing, Data Science, MATLAB, Python, STM32. Strong education professional with a Master’s degree in Communication Systems Engineering from L.D. College of Engineering - Ahmedabad.
Table of Contents

This post demonstrates how to use Mermaid diagrams in Hugo. Mermaid lets you create diagrams and visualizations using text and code.

Flowchart Example
#

graph LR;
A[Lemons]-->B[Lemonade];
B-->C[Profit]
flowchart LR
    A[Start] --> B{Is it?}
    B -- Yes --> C[OK]
    C --> D[Rethink]
    D --> B
    B -- No --> E[End]

Sequence Diagram Example
#

sequenceDiagram
    participant Alice
    participant Bob
    Alice->>John: Hello John, how are you?
    loop Healthcheck
        John->>John: Fight against hypochondria
    end
    Note right of John: Rational thoughts<br/>prevail...
    John-->>Alice: Great!
    John->>Bob: How about you?
    Bob-->>John: Jolly good!

Class Diagram Example
#

classDiagram
    Animal <|-- Duck
    Animal <|-- Fish
    Animal <|-- Zebra
    Animal : +int age
    Animal : +String gender
    Animal: +isMammal()
    Animal: +mate()
    class Duck{
      +String beakColor
      +swim()
      +quack()
    }
    class Fish{
      -int sizeInFeet
      -canEat()
    }
    class Zebra{
      +bool is_wild
      +run()
    }

Gantt Chart Example
#

gantt
    title A Gantt Diagram
    dateFormat  YYYY-MM-DD
    section Section
    A task           :a1, 2025-03-01, 30d
    Another task     :after a1, 20d
    section Another
    Task in sec      :2025-03-12, 12d
    another task     :24d

State Diagram
#

stateDiagram-v2
    [*] --> Still
    Still --> [*]
    Still --> Moving
    Moving --> Still
    Moving --> Crash
    Crash --> [*]

Pie Chart
#

pie
    title What kind of diagrams do you prefer?
    "ASCII Art" : 40
    "Mermaid" : 35
    "Other Tools" : 25

Git Graph
#

gitGraph
    commit
    commit
    branch develop
    checkout develop
    commit
    commit
    checkout main
    merge develop
    commit
    commit

Entity Relationship Diagram
#

erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE-ITEM : contains
    CUSTOMER }|..|{ DELIVERY-ADDRESS : uses

Related

Markdown Syntax Guide
2 mins
Themes Syntax Markdown Css Html Themes
Code Syntax Guide
2 mins
Themes Syntax Markdown Syntax Code Gist
Rich Content and Shortcodes
1 min
Markdown Shortcodes Privacy
Java Programming Language Book
199 mins
4343203 Study-Material Java Programming Language Book Tutorial
Choosing the Right Service Management System for IT Service Providers: GLPI vs ERPNext vs Zammad
·7 mins
IT Service Management GLPI ERPNext Zammad Asset Management Help Desk Opensource ITSM
Digital Electronics (4321102) - Winter 2024 Solution
21 mins
Study-Material Solutions Digital-Electronics 4321102 2024 Winter