Enable Mermaid.js
This commit is contained in:
parent
b79e594dd2
commit
a2e984afcf
@ -2,22 +2,32 @@
|
|||||||
<html lang="{{ .Site.Language }}" dir="{{ .Language.LanguageDirection | default " auto" }}">
|
<html lang="{{ .Site.Language }}" dir="{{ .Language.LanguageDirection | default " auto" }}">
|
||||||
|
|
||||||
<head>
|
<head>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js"></script>
|
||||||
{{- partial "head.html" . }}
|
{{- partial "head.html" . }}
|
||||||
|
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8721803444159352"
|
||||||
|
crossorigin="anonymous"></script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body class="
|
<body class="
|
||||||
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
|
{{- if (or (ne .Kind `page` ) (eq .Layout `archives`) (eq .Layout `search`)) -}}
|
||||||
{{- print "list" -}}
|
{{- print " list" -}} {{- end -}} {{- if eq $.Site.Params.defaultTheme `dark` -}} {{- print " dark" }} {{- end
|
||||||
{{- end -}}
|
-}} " id="top">
|
||||||
{{- if eq $.Site.Params.defaultTheme `dark` -}}
|
|
||||||
{{- print " dark" }}
|
|
||||||
{{- end -}}
|
|
||||||
" id="top">
|
|
||||||
{{- partialCached "header.html" . .Page -}}
|
{{- partialCached "header.html" . .Page -}}
|
||||||
<main class="main">
|
<main class="main">
|
||||||
{{- block "main" . }}{{ end }}
|
{{- block "main" . }}{{ end }}
|
||||||
</main>
|
</main>
|
||||||
{{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}}
|
{{ partialCached "footer.html" . .Layout .Kind (.Param "hideFooter") (.Param "ShowCodeCopyButtons") -}}
|
||||||
|
|
||||||
|
<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>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -90,6 +90,8 @@
|
|||||||
mermaid.init(undefined, '.language-mermaid');
|
mermaid.init(undefined, '.language-mermaid');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
||||||
@ -142,16 +144,3 @@
|
|||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
{{- end }}
|
{{- 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}}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user