mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2024-11-23 15:57:57 +00:00
mermaid: assert that window.mermaid is actually mermaid #136
This commit is contained in:
parent
139c587757
commit
f3c067bf9b
2 changed files with 2 additions and 2 deletions
|
@ -42,7 +42,7 @@
|
||||||
{{- $.Scratch.Set "mermaidInitialize" "{ \"startOnLoad\": true }" }}
|
{{- $.Scratch.Set "mermaidInitialize" "{ \"startOnLoad\": true }" }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
<script>
|
<script>
|
||||||
if (typeof mermaid != 'undefined') {
|
if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') {
|
||||||
mermaid.mermaidAPI.initialize( Object.assign( { "securityLevel": "antiscript" }, JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}), { startOnLoad: false } ) );
|
mermaid.mermaidAPI.initialize( Object.assign( { "securityLevel": "antiscript" }, JSON.parse({{ $.Scratch.Get "mermaidInitialize" }}), { startOnLoad: false } ) );
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -104,7 +104,7 @@ function initMermaid() {
|
||||||
$(element).parent().replaceWith('<div class="mermaid" align="center">' + content + '</div>');
|
$(element).parent().replaceWith('<div class="mermaid" align="center">' + content + '</div>');
|
||||||
});
|
});
|
||||||
|
|
||||||
if (typeof mermaid != 'undefined') {
|
if (typeof mermaid != 'undefined' && typeof mermaid.mermaidAPI != 'undefined') {
|
||||||
mermaid.mermaidAPI.initialize( Object.assign( {}, mermaid.mermaidAPI.getSiteConfig(), { startOnLoad: true } ) );
|
mermaid.mermaidAPI.initialize( Object.assign( {}, mermaid.mermaidAPI.getSiteConfig(), { startOnLoad: true } ) );
|
||||||
mermaid.contentLoaded();
|
mermaid.contentLoaded();
|
||||||
$(".mermaid svg").svgPanZoom({})
|
$(".mermaid svg").svgPanZoom({})
|
||||||
|
|
Loading…
Reference in a new issue