Skip to content

Commit

Permalink
✨ Feat: update mermaid to 11.3.0 to support more diagrams
Browse files Browse the repository at this point in the history
  • Loading branch information
Lruihao committed Oct 25, 2024
1 parent c08671d commit 64f954c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions assets/js/theme.js
Original file line number Diff line number Diff line change
Expand Up @@ -601,11 +601,11 @@ class FixIt {
}

initMermaid() {
if (!window.mermaid?.initialize) {
if (!this.config.mermaid) {
return;
}
const _initializeAndRun = () => {
const themes = window.mermaid.themes ?? ['default', 'dark'];
const themes = this.config.mermaid.themes ?? ['default', 'dark'];
window.mermaid.initialize({
securityLevel: 'loose',
startOnLoad: false,
Expand Down
7 changes: 5 additions & 2 deletions layouts/partials/assets.html
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,13 @@

{{- /* mermaid */ -}}
{{- if .Store.Get "hasMermaid" -}}
{{- $config = dict "themes" .Site.Params.mermaid.themes | dict "mermaid" | merge $config -}}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.3.0/dist/mermaid.esm.min.mjs';
// Style conflict with ZenUML
// import zenuml from 'https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml@0.2.0/dist/mermaid-zenuml.esm.min.mjs'
// await mermaid.registerExternalDiagrams([zenuml]);
window.mermaid = mermaid;
window.mermaid.themes = {{ .Site.Params.mermaid.themes }};
</script>
{{- end -}}

Expand Down
2 changes: 1 addition & 1 deletion layouts/partials/init/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{- .Scratch.Set "version" "v0.3.14-28759d50" -}}
{{- .Scratch.Set "version" "v0.3.14-c08671de" -}}
{{- .Scratch.Set "this" dict -}}

{{- partial "init/detection-env.html" . -}}
Expand Down

0 comments on commit 64f954c

Please sign in to comment.