diff --git a/doc/content/features.md b/doc/content/features.md index 88a5bde5..cf46322f 100644 --- a/doc/content/features.md +++ b/doc/content/features.md @@ -124,3 +124,25 @@ To use them elsewhere, e.g. in Hugo templates, we provide an `svg-icon` partial. ``` {{ partial "svg-icon" "my-icon" }} ``` + +## Mermaid diagrams + +[Mermaid](https://mermaid.js.org/) diagrams are rendered from code blocks: + +````md +```mermaid +graph LR + A[Square Rect] -- Link text --> B((Circle)) + A --> C(Round Rect) + B --> D{Rhombus} + C --> D +``` +```` + +```mermaid +graph LR + A[Square Rect] -- Link text --> B((Circle)) + A --> C(Round Rect) + B --> D{Rhombus} + C --> D +``` diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html new file mode 100644 index 00000000..94ea0cad --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -0,0 +1,4 @@ +
+ {{- .Inner | safeHTML }} ++{{ .Page.Store.Set "hasMermaid" true }} diff --git a/layouts/partials/javascript.html b/layouts/partials/javascript.html index be10cf03..5399a055 100644 --- a/layouts/partials/javascript.html +++ b/layouts/partials/javascript.html @@ -36,7 +36,7 @@ {{ end -}} -{{- if .HasShortcode "mermaid" }} +{{- if .Page.Store.Get "hasMermaid" }}