Integrate mermaid
This commit is contained in:
parent
aa2825a2a7
commit
d4e86b557b
2 changed files with 29 additions and 0 deletions
4
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
4
layouts/_default/_markup/render-codeblock-mermaid.html
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<pre class="mermaid">
|
||||||
|
{{- .Inner | safeHTML }}
|
||||||
|
</pre>
|
||||||
|
{{ .Page.Store.Set "hasMermaid" true }}
|
|
@ -9,3 +9,28 @@
|
||||||
<script src="{{ $val }}"></script>
|
<script src="{{ $val }}"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if .Page.Store.Get "hasMermaid" }}
|
||||||
|
<script type="module">
|
||||||
|
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
|
||||||
|
const settings = localStorage.getItem('theme') === 'dark' ?
|
||||||
|
{
|
||||||
|
startOnLoad: true,
|
||||||
|
theme: 'dark',
|
||||||
|
darkMode: true,
|
||||||
|
themeVariables: {
|
||||||
|
tertiaryColor: '#dee3ed'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
:
|
||||||
|
{
|
||||||
|
startOnLoad: true,
|
||||||
|
theme: 'base',
|
||||||
|
darkMode: false,
|
||||||
|
themeVariables: {
|
||||||
|
tertiaryColor: '#dee3ed'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
;
|
||||||
|
mermaid.initialize(settings);
|
||||||
|
</script>
|
||||||
|
{{ end }}
|
Loading…
Add table
Add a link
Reference in a new issue