blog/layouts/shortcodes/mermaid.html
Bruno BELANYI 2118ba170f
All checks were successful
ci/woodpecker/push/deploy/2 Pipeline was successful
layouts: add Mermaid support
Similar to Graphviz and TikZ support.
2024-07-20 17:24:54 +01:00

17 lines
506 B
HTML

<pre class="mermaid">
{{ with .Get "file" }}
{{ if eq (. | printf "%.1s") "/" }}
{{/* Absolute path are from root of site. */}}
{{ $.Scratch.Set "filepath" . }}
{{ else }}
{{/* Relative paths are from page directory. */}}
{{ $.Scratch.Set "filepath" $.Page.File.Dir }}
{{ $.Scratch.Add "filepath" . }}
{{ end }}
{{ $.Scratch.Get "filepath" | readFile }}
{{ else }}
{{.Inner}}
{{ end }}
</pre>