Skip to content

Commit

Permalink
dependencies: fix mermaid and mathjax initialization #682
Browse files Browse the repository at this point in the history
caused the stylesheet generator to ignore clicks
  • Loading branch information
McShelby committed Oct 26, 2023
1 parent d2583cf commit 5a534d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
9 changes: 4 additions & 5 deletions layouts/partials/dependencies/mathjax.html
Original file line number Diff line number Diff line change
@@ -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 ){
Expand Down Expand Up @@ -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>
Expand Down
9 changes: 4 additions & 5 deletions layouts/partials/dependencies/mermaid.html
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

0 comments on commit 5a534d0

Please sign in to comment.