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
|
||||
disableMermaid = false
|
||||
customMermaidURL = "https://unpkg.com/mermaid@8.8.0/dist/mermaid.min.js"
|
||||
mermaidInitialize = "{ \"securityLevel\": \"loose\", \"startOnLoad\": true }"
|
||||
titleSeparator = "::"
|
||||
themeVariant = "relearn"
|
||||
|
||||
|
|
|
@ -74,9 +74,17 @@
|
|||
{{ else }}
|
||||
<script src="{{"mermaid/mermaid.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}"></script>
|
||||
{{ 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>
|
||||
if (mermaid) {
|
||||
mermaid.startOnLoad = false;
|
||||
mermaid.initialize(JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}));
|
||||
}
|
||||
</script>
|
||||
{{ end }}
|
||||
|
|
Loading…
Reference in a new issue