layouts/mermaid: inline init script (PaperMod footer is partialCached)
publish / build-and-publish (push) Successful in 4s
publish / build-and-publish (push) Successful in 4s
This commit is contained in:
@@ -1,4 +1,12 @@
|
|||||||
|
{{- $page := .Page -}}
|
||||||
<pre class="mermaid">
|
<pre class="mermaid">
|
||||||
{{- .Inner | safeHTML -}}
|
{{- .Inner | safeHTML -}}
|
||||||
</pre>
|
</pre>
|
||||||
{{ .Page.Store.Set "hasMermaid" true }}
|
{{- if not ($page.Store.Get "mermaidScriptAdded") -}}
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs";
|
||||||
|
const theme = document.documentElement.dataset.theme === "dark" ? "dark" : "default";
|
||||||
|
mermaid.initialize({ startOnLoad: true, theme });
|
||||||
|
</script>
|
||||||
|
{{- $page.Store.Set "mermaidScriptAdded" true -}}
|
||||||
|
{{- end -}}
|
||||||
|
|||||||
Reference in New Issue
Block a user