hugo-book-theme/layouts/shortcodes/mermaid.html
FuadEfendi ffaea4a4c8
Fix for spaces being removed during "minify" build for "mermaid" snippet
"mindmap" style is not rendered correctly with "--minify"  because spaces are removed from final HTML
2024-04-28 12:11:49 -04:00

12 lines
400 B
HTML

{{ if not (.Page.Scratch.Get "mermaid") }}
<!-- Include mermaid only first time -->
<script src="{{ "mermaid.min.js" | relURL }}"></script>
{{ with resources.Get "mermaid.json" }}
<script>mermaid.initialize({{ .Content | safeJS }})</script>
{{ end }}
{{ .Page.Scratch.Set "mermaid" true }}
{{ end }}
<pre class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
{{- .Inner | safeHTML -}}
</pre>