mirror of
https://github.com/thegeeklab/hugo-geekdoc.git
synced 2024-11-04 20:30:40 +00:00
34 lines
1.0 KiB
HTML
34 lines
1.0 KiB
HTML
{{ if not (.Page.Scratch.Get "mermaid") }}
|
|
<!-- Include mermaid only first time -->
|
|
<script defer src="{{ index .Site.Data.assets "js/mermaid.min.js" | relURL }}"></script>
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function(event) {
|
|
let currentMode = localStorage.getItem(THEME);
|
|
let darkModeQuery = window.matchMedia("(prefers-color-scheme: dark)");
|
|
let primaryColor = "#ececff";
|
|
let darkMode = false;
|
|
|
|
console.log(currentMode)
|
|
|
|
if (currentMode === DARK_MODE || (currentMode === AUTO_MODE && darkModeQuery.matches)) {
|
|
primaryColor = "#6C617E";
|
|
darkMode = true;
|
|
}
|
|
|
|
mermaid.initialize({
|
|
flowchart: { useMaxWidth: true },
|
|
theme: "base",
|
|
themeVariables: {
|
|
darkMode: darkMode,
|
|
primaryColor: primaryColor,
|
|
},
|
|
});
|
|
});
|
|
</script>
|
|
{{ .Page.Scratch.Set "mermaid" true }}
|
|
{{ end }}
|
|
|
|
<pre class="gdoc-mermaid mermaid{{ with .Get "class" }} {{ . }}{{ end }}">
|
|
{{- .Inner -}}
|
|
</pre>
|