Diagram Support Hugo v0.93.0 - Mermaid Diagrams

post/01-diagram-support.webp

Hugo currently does not provide default templates for Mermaid diagrams. But you can easily add your own. One way to do it would be to create

layouts/_default/_markup/render-codeblock-mermaid.html:

1<div class="mermaid">
2  {{- .Inner | safeHTML }}
3</div>
4{{ .Page.Store.Set "hasMermaid" true }}

And then include this snippet at the bottom of the content template (below .Content):

1{{ if .Page.Store.Get "hasMermaid" }}
2  <script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
3  <script>
4    mermaid.initialize({ startOnLoad: true });
5  </script>
6{{ end }}

With that you can use the mermaid language in Markdown code blocks:

maindevelopZEROAONEBTWOcherry-pick:BTHREEC23

ftth

wan

in

out

lan

lan

lan

wlan

wlan

wlan

poe

poe

usb

wbee

wbee

wbee

wbee

wbee

wbee

wbee

UT

Innbox G21

RBD53iG-5HacD2HnD

DNS

Hassio

Desctop

POE

Cam w01

Cam w02

iPad2

RLC 512

RLC 512

Coordinator

bm1

bm2

dw1

dw2

lp1

lp2

qp

46%40%9%5%Key elements in Product XPotassium [50.05]Calcium [42.96]Magnesium [10.01]Iron [5]

places

contains

uses

CUSTOMER

ORDER

LINE-ITEM

DELIVERY-ADDRESS

section

Get money

One

Two

Three

Christmas

Go shopping

Let me think

Another

Laptop

iPhone

Car

The state with a note

Important information! You can write
notes.

State2

This is the note to the left

2014-01-052014-01-122014-01-192014-01-262014-02-022014-02-092014-02-16A task Task in sec another task Another task SectionAnotherA Gantt Diagram
CatMe
Go to work
Go to work
Me
Make tea
Make tea
Me
Go upstairs
Go upstairs
MeCat
Do work
Do work
Go home
Go home
Me
Go downstairs
Go downstairs
Me
Sit down
Sit down
My working day
The Latest