mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 07:47:54 +00:00
mermaid: header is showing up in FF #311
This commit is contained in:
parent
4a50b27d65
commit
8f6e091a65
2 changed files with 26 additions and 18 deletions
|
@ -18,7 +18,7 @@
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<script>
|
<script>
|
||||||
function useMathJax( config ){
|
function useMathJax( config ){
|
||||||
window.MathJax = Object.assign({
|
window.MathJax = Object.assign( window.MathJax || {}, {
|
||||||
loader: {
|
loader: {
|
||||||
load: ['[tex]/mhchem']
|
load: ['[tex]/mhchem']
|
||||||
},
|
},
|
||||||
|
@ -66,16 +66,7 @@
|
||||||
{{- $.Scratch.Set "mermaidInitialize" "{}" }}
|
{{- $.Scratch.Set "mermaidInitialize" "{}" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<script>
|
<script>
|
||||||
function useMermaid( config ){
|
window.themeUseMermaid = JSON.parse({{ $.Scratch.Get "mermaidInitialize" }});
|
||||||
if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') {
|
|
||||||
mermaid.initialize( Object.assign( { "securityLevel": "antiscript", "startOnLoad": false }, config ) );
|
|
||||||
if( config.theme && variants ){
|
|
||||||
var write_style = variants.findLoadedStylesheet( 'variant-style' );
|
|
||||||
write_style.setProperty( '--CONFIG-MERMAID-theme', config.theme );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
useMermaid( JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}) );
|
|
||||||
</script>
|
</script>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- $wantsSwagger := or (.Page.Store.Get "hasSwagger") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasSwagger")) }}
|
{{- $wantsSwagger := or (.Page.Store.Get "hasSwagger") (and (.Page.Store.Get (printf "%sIsNested" (partial "output-format.hugo" .Page))) (.Page.Store.Get "nestedHasSwagger")) }}
|
||||||
|
@ -95,13 +86,7 @@
|
||||||
{{- $.Scratch.Set "swaggerInitialize" "{}" }}
|
{{- $.Scratch.Set "swaggerInitialize" "{}" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<script>
|
<script>
|
||||||
function useSwagger( config ){
|
window.themeUseSwagger = JSON.parse({{ $.Scratch.Get "swaggerInitialize" }});
|
||||||
if( config.theme && variants ){
|
|
||||||
var write_style = variants.findLoadedStylesheet( 'variant-style' );
|
|
||||||
write_style.setProperty( '--CONFIG-SWAGGER-theme', config.theme );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
useSwagger( JSON.parse({{ $.Scratch.Get "swaggerInitialize" }}) );
|
|
||||||
</script>
|
</script>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<script src="{{"js/theme.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
<script src="{{"js/theme.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>
|
||||||
|
|
|
@ -894,3 +894,26 @@ jQuery.fn.highlight = function(words, options) {
|
||||||
jQuery.highlight(this, re, settings.element, settings.className);
|
jQuery.highlight(this, re, settings.element, settings.className);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function useMermaid( config ){
|
||||||
|
if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') {
|
||||||
|
mermaid.initialize( Object.assign( { "securityLevel": "antiscript", "startOnLoad": false }, config ) );
|
||||||
|
if( config.theme && variants ){
|
||||||
|
var write_style = variants.findLoadedStylesheet( 'variant-style' );
|
||||||
|
write_style.setProperty( '--CONFIG-MERMAID-theme', config.theme );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( themeUseMermaid ){
|
||||||
|
useMermaid( themeUseMermaid );
|
||||||
|
}
|
||||||
|
|
||||||
|
function useSwagger( config ){
|
||||||
|
if( config.theme && variants ){
|
||||||
|
var write_style = variants.findLoadedStylesheet( 'variant-style' );
|
||||||
|
write_style.setProperty( '--CONFIG-SWAGGER-theme', config.theme );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( themeUseSwagger ){
|
||||||
|
useSwagger( themeUseSwagger );
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue