22 lines
734 B
HTML
22 lines
734 B
HTML
|
{{- $defaultCDN := "https://cdn.jsdelivr.net" -}}
|
||
|
<script src="{{- .Site.Params.cdnCustomized | default $defaultCDN -}}/npm/mermaid@8.8.3/dist/mermaid.min.js"></script>
|
||
|
<script>
|
||
|
let mermaidConfig = {
|
||
|
startOnLoad: true,
|
||
|
flowchart: {
|
||
|
useMaxWidth: false,
|
||
|
htmlLabels: true
|
||
|
},
|
||
|
theme: '{{ template "mermaid-theme" . }}'
|
||
|
};
|
||
|
mermaid.initialize(mermaidConfig);
|
||
|
</script>
|
||
|
|
||
|
{{- define "mermaid-theme" -}}
|
||
|
{{- $theme := .Site.Params.mermaidTheme | default "default" -}}
|
||
|
{{- if and .Site.Params.enableDarkMode (eq .Site.Params.defaultTheme "dark") -}}
|
||
|
{{- $theme = .Site.Params.mermaidThemeDark | default "dark" -}}
|
||
|
{{- end -}}
|
||
|
{{- $theme -}}
|
||
|
{{- end -}}
|