Merge pull request #26 from simon-siggaard/main

add support for Mermaid diagrams
This commit is contained in:
Francesco Tomaselli 2024-09-21 21:33:39 +02:00 committed by GitHub
commit 4fe47ad315
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,4 @@
<pre class="mermaid">
{{- .Inner | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}

View File

@ -70,6 +70,14 @@
{{ end }}
</div>
{{ if .Store.Get "hasMermaid" }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
</script>
{{ end }}
{{/* Next prev controls */}}
{{ if not (.Param "hidePagination") }}
@ -88,4 +96,4 @@
</div>
{{ end }}
{{ end }}