diff options
-rw-r--r-- | layouts/_default/_markup/render-codeblock-mermaid.html | 4 | ||||
-rw-r--r-- | layouts/_default/single.html | 10 |
2 files changed, 13 insertions, 1 deletions
diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..bb7bf42 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -0,0 +1,4 @@ +<pre class="mermaid"> + {{- .Inner | safeHTML }} +</pre> +{{ .Page.Store.Set "hasMermaid" true }}
\ No newline at end of file diff --git a/layouts/_default/single.html b/layouts/_default/single.html index 9282d4e..000977a 100644 --- a/layouts/_default/single.html +++ b/layouts/_default/single.html @@ -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 }}
\ No newline at end of file |