mermaid: header is showing up in FF #311

This commit is contained in:
Sören Weber 2022-07-17 19:42:07 +02:00
parent 4a50b27d65
commit 8f6e091a65
No known key found for this signature in database
GPG key ID: 07D17FF580AE7589
2 changed files with 26 additions and 18 deletions

View file

@ -18,7 +18,7 @@
{{- end }}
<script>
function useMathJax( config ){
window.MathJax = Object.assign({
window.MathJax = Object.assign( window.MathJax || {}, {
loader: {
load: ['[tex]/mhchem']
},
@ -66,16 +66,7 @@
{{- $.Scratch.Set "mermaidInitialize" "{}" }}
{{- end }}
<script>
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 );
}
}
}
useMermaid( JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}) );
window.themeUseMermaid = JSON.parse({{ $.Scratch.Get "mermaidInitialize" }});
</script>
{{- end }}
{{- $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" "{}" }}
{{- end }}
<script>
function useSwagger( config ){
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" }}) );
window.themeUseSwagger = JSON.parse({{ $.Scratch.Get "swaggerInitialize" }});
</script>
{{- end }}
<script src="{{"js/theme.js" | relURL}}{{ if not .Site.Params.disableAssetsBusting }}?{{ now.Unix }}{{ end }}" defer></script>

View file

@ -894,3 +894,26 @@ jQuery.fn.highlight = function(words, options) {
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 );
}