Skip to content

Commit

Permalink
Enable rendering Mermaid diagrams (#5354)
Browse files Browse the repository at this point in the history
Signed-off-by: t-kikuc <[email protected]>
  • Loading branch information
t-kikuc authored Nov 20, 2024
1 parent 7e5d4ea commit fc49f59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions docs/layouts/_default/_markup/render-codeblock-mermaid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{{/* Enable rendering Mermaid diagrams. See https://gohugo.io/content-management/diagrams/#mermaid-diagrams. */}}
<pre class="mermaid">
{{- .Inner | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}
8 changes: 8 additions & 0 deletions docs/layouts/partials/scripts.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,11 @@
<script src="{{ $js.RelPermalink }}" integrity="{{ $js.Data.Integrity }}" crossorigin="anonymous"></script>
{{ end }}
{{ partial "hooks/body-end.html" . }}

{{/* Enable rendering Mermaid diagrams. See https://gohugo.io/content-management/diagrams/#mermaid-diagrams. */}}
{{ 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 }}

0 comments on commit fc49f59

Please sign in to comment.