dependencies: fix mermaid and mathjax initialization #682

caused the stylesheet generator to ignore clicks
This commit is contained in:
Sören Weber 2023-10-26 11:27:53 +02:00
parent d2583cf498
commit 5a534d02b2
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 8 additions and 10 deletions

View file

@ -1,11 +1,10 @@
{{- $page := .page }}
{{- with $page }}
{{- $init := "{}" }}
{{- if isset .Params "mathjaxinitialize" }}
{{- $.Scratch.Set "mathJaxInitialize" .Params.mathJaxInitialize }}
{{- $init = .Params.mathJaxInitialize }}
{{- else if isset .Site.Params "mathjaxinitialize" }}
{{- $.Scratch.Set "mathJaxInitialize" .Site.Params.mathJaxInitialize }}
{{- else }}
{{- $.Scratch.Set "mathJaxInitialize" "{}" }}
{{- $init = .Site.Params.mathJaxInitialize }}
{{- end }}
<script>
function useMathJax( config ){
@ -33,7 +32,7 @@
}
}, config );
}
useMathJax( JSON.parse({{ $.Scratch.Get "mathJaxInitialize" }}) );
useMathJax( JSON.parse({{ $init }}) );
</script>
{{- if isset .Params "custommathjaxurl" }}
<script id="MathJax-script" async src="{{ .Params.customMathJaxURL }}"></script>

View file

@ -17,14 +17,13 @@
{{- else }}
<script src="{{"js/mermaid.min.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
{{- end }}
{{- $init := "{}" }}
{{- if isset .Params "mermaidinitialize" }}
{{- $.Scratch.Set "mermaidInitialize" .Params.mermaidInitialize }}
{{- $init = .Params.mermaidInitialize }}
{{- else if isset .Site.Params "mermaidinitialize" }}
{{- $.Scratch.Set "mermaidInitialize" .Site.Params.mermaidInitialize }}
{{- else }}
{{- $.Scratch.Set "mermaidInitialize" "{}" }}
{{- $init = .Site.Params.mermaidInitialize }}
{{- end }}
<script>
window.themeUseMermaid = JSON.parse({{ $.Scratch.Get "mermaidInitialize" }});
window.themeUseMermaid = JSON.parse({{ $init }});
</script>
{{- end }}