From the Mind of Bob

What I think, what I hear, what I see

New Mermaid Test

2026-02-04 Test Mermaid Bob Ossler

Using Mermaid Markdown Syntax in Hugo

I am trying out the newest version of Mermaid, and also a new way to set it up within Hugo. Instead of the shortcode I setup from the previous article, I have created a code block render hook, as found in the Hugo documentation on the Hugo Website.

I have written a markdown code block of type Mermaid, to render the diagram found below…

Sequence Diagram

  
---
config:
  theme: 'base'
  themeVariables:
    darkMode: true
    background: '#f4f4f4'
    primaryColor: '#ccc4dd'
    primaryTextColor: '#aa2825'
---
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!

Click the pencil icon next to the post to see the render

Mermaid Test

2023-07-01 Test Mermaid Bob Ossler

Using Mermaid in Hugo

I am trying out the mermaid markdown-like syntax for creating code diagrams, graphs, and pie charts.

Graph L-R

--- config: theme: 'base' themeVariables: darkMode: false background: '#f4f4f4' primaryColor: '#ccc4dd' primaryTextColor: '#aa2825' lineColor: '#ccc' --- graph LR; Root-->A & B & C A-->A1-->A2--->A3 B-->B1-->B2-->B3 C--->C1-->C2-->C3

Graph Top-Down

--- config: theme: 'base' themeVariables: darkMode: false background: '#f4f4f4' primaryColor: '#ccc4dd' primaryTextColor: '#aa2825' lineColor: '#ccc' --- graph TD; A-->B; A-->C; B-->D; C-->D;

Pie Chart

--- config: theme: 'base' themeVariables: darkMode: false background: '#f4f4f4' primaryColor: '#ccc4dd' primaryTextColor: '#aa2825' lineColor: '#ccc' --- pie title Linux Distributions "Debian":42.96 "Ubuntu":50.05 "Arch":10.01 "CentOS":5

Flowchart

--- config: theme: 'base' themeVariables: darkMode: false background: '#f4f4f4' primaryColor: '#ccc4dd' primaryTextColor: '#aa2825' lineColor: '#ccc' --- flowchart TD; A[Choose OS] --> B{Do you want?} B -- Yes --> C[UNIX or Windows] C -- Windows --> D[Good Luck!] C -- UNIX --> E{Linux or macOS} E -- Linux --> G{Good Choice!} E -- macOS --> H{apple.com} B -- No ---> F[End]

And that’s only a few examples of what can be done using mermaid. I pulled these examples out of an article I read in Ultimate Linux Projects, Issue 2, written by Mihalis Tsoukalos. I had to make several corrections to the mermaid syntax provided by the author; possibly because of mermaid version changes.

Continue reading