summaryrefslogtreecommitdiffstats
path: root/layouts
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-11-13 00:51:09 +0100
committerAhmed Abdelhalim <[email protected]>2025-11-13 00:51:09 +0100
commitb4307e276b04aa270f213c6c932a666e486dd1ad (patch)
tree742e488af3878ffa99a92431903812aa9f5a38e9 /layouts
parent2214b1463f87eb4d6291e71cb65aed25f5054e08 (diff)
Add mermaid support for rendering graphs
Diffstat (limited to 'layouts')
-rw-r--r--layouts/_default/baseof.html6
-rw-r--r--layouts/_markup/render-codeblock-mermaid.html4
2 files changed, 10 insertions, 0 deletions
diff --git a/layouts/_default/baseof.html b/layouts/_default/baseof.html
index 9b0edef..36f8072 100644
--- a/layouts/_default/baseof.html
+++ b/layouts/_default/baseof.html
@@ -19,6 +19,12 @@
{{ block "main" . }}
{{ end }}
</main>
+ {{ 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 }}
</body>
<footer>
{{ block "footer" . }}
diff --git a/layouts/_markup/render-codeblock-mermaid.html b/layouts/_markup/render-codeblock-mermaid.html
new file mode 100644
index 0000000..42e8abf
--- /dev/null
+++ b/layouts/_markup/render-codeblock-mermaid.html
@@ -0,0 +1,4 @@
+<pre class="mermaid">
+ {{ .Inner | htmlEscape | safeHTML }}
+</pre>
+{{ .Page.Store.Set "hasMermaid" true }}