Add support for mermaid.js (#13115)

Fixes https://github.com/istio/istio.io/issues/13093
This commit is contained in:
John Howard 2023-04-26 06:39:35 -07:00 committed by GitHub
parent f8c8b54ff5
commit 53ff275bb4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 0 deletions

View File

@ -145,6 +145,19 @@
<!-- our own stuff --> <!-- our own stuff -->
<script src="/js/all.min.js" data-manual defer></script> <script src="/js/all.min.js" data-manual defer></script>
{{ if .Page.Store.Get "needMermaid" -}}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
mermaid.initialize({
startOnLoad: true,
'theme': 'base',
'themeVariables': {
'primaryColor': '#B7D4FF',
'primaryBorderColor': '#9BB9FF',
}
});
</script>
{{ end -}}
{{ partial "events.html" (dict "page" . "kind" "sticker") }} {{ partial "events.html" (dict "page" . "kind" "sticker") }}
{{ partial "header.html" . }} {{ partial "header.html" . }}

View File

@ -0,0 +1,2 @@
{{ .Page.Store.Set "needMermaid" true }}
<div class="mermaid" align="center">{{ safeHTML .Inner }}</div>