mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-01-18 19:00:24 +00:00
expose mermaid options in config.toml #4
This commit is contained in:
parent
b52a263979
commit
3564d9ebfa
2 changed files with 9 additions and 0 deletions
|
@ -19,6 +19,7 @@ relativeURLs = true
|
||||||
disableLandingPageButton = true
|
disableLandingPageButton = true
|
||||||
disableMermaid = false
|
disableMermaid = false
|
||||||
customMermaidURL = "https://unpkg.com/mermaid@8.8.0/dist/mermaid.min.js"
|
customMermaidURL = "https://unpkg.com/mermaid@8.8.0/dist/mermaid.min.js"
|
||||||
|
mermaidInitialize = "{ \"securityLevel\": \"loose\", \"startOnLoad\": true }"
|
||||||
titleSeparator = "::"
|
titleSeparator = "::"
|
||||||
themeVariant = "relearn"
|
themeVariant = "relearn"
|
||||||
|
|
||||||
|
|
|
@ -74,9 +74,17 @@
|
||||||
{{ else }}
|
{{ else }}
|
||||||
<script src="{{"mermaid/mermaid.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
<script src="{{"mermaid/mermaid.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
{{ if isset .Params "mermaidinitialize" }}
|
||||||
|
{{ $.Scratch.Set "mermaidInitialize" .Params.mermaidInitialize }}
|
||||||
|
{{ else if isset .Site.Params "mermaidinitialize" }}
|
||||||
|
{{ $.Scratch.Set "mermaidInitialize" .Site.Params.mermaidInitialize }}
|
||||||
|
{{ else }}
|
||||||
|
{{ $.Scratch.Set "mermaidInitialize" "{ \"startOnLoad\": true }" }}
|
||||||
|
{{ end }}
|
||||||
<script>
|
<script>
|
||||||
if (mermaid) {
|
if (mermaid) {
|
||||||
mermaid.startOnLoad = false;
|
mermaid.startOnLoad = false;
|
||||||
|
mermaid.initialize(JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}));
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
Loading…
Reference in a new issue