aboutsummaryrefslogtreecommitdiff
path: root/layouts/shortcodes/mermaid.html
blob: ff90335037e6a9220bc9ab2af5dfd4bc19bdc9b0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
{{ 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 }}

<p class="mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
  {{- .Inner -}}
</p>