Enable Mermaid.js

This commit is contained in:
lottotto
2022-03-25 22:44:41 +09:00
parent b79e594dd2
commit a2e984afcf
2 changed files with 19 additions and 20 deletions

View File

@ -90,6 +90,8 @@
mermaid.init(undefined, '.language-mermaid');
})
</script>
{{- end }}
@ -142,16 +144,3 @@
});
</script>
{{- end }}
{{- if (and (eq .Kind "page") (ne .Layout "archives") (ne .Layout "search")) }}
<script>
if (localStorage.getItem("pref-theme") == 'dark') {
theme = 'dark'
} else {
theme = ''
}
mermaidTextContents = Array.from(document.getElementsByClassName("language-mermaid")).map(value => value.innerHTML)
mermaid.initialize({ theme: theme, startOnLoad: true });
mermaid.init(undefined, '.language-mermaid');
</script>
{{- end}}