Skip to content

Commit

Permalink
added functionality for mermaid diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
Westley-Winks committed Jul 20, 2023
1 parent 5e22776 commit 558d45e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions layouts/_default/_markup/render-codeblock-mermaid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<pre class="mermaid">
{{- .Inner | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}
9 changes: 8 additions & 1 deletion layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,11 @@
<a href="{{ .Permalink }}"><button>{{ .Title }} >></button></a>
{{ end }}

{{ end }}
{{ if .Page.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 }}

{{ end }}

0 comments on commit 558d45e

Please sign in to comment.