From 64f954ccf7c6ff3702a712f19d0439c55ee062d5 Mon Sep 17 00:00:00 2001 From: Cell <1024@lruihao.cn> Date: Fri, 25 Oct 2024 14:12:40 +0800 Subject: [PATCH] :sparkles: Feat: update mermaid to 11.3.0 to support more diagrams --- assets/js/theme.js | 4 ++-- layouts/partials/assets.html | 7 +++++-- layouts/partials/init/index.html | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/js/theme.js b/assets/js/theme.js index 71aaa49a..6b0c6249 100644 --- a/assets/js/theme.js +++ b/assets/js/theme.js @@ -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, diff --git a/layouts/partials/assets.html b/layouts/partials/assets.html index 3d010853..cfebaffb 100644 --- a/layouts/partials/assets.html +++ b/layouts/partials/assets.html @@ -115,10 +115,13 @@ {{- /* mermaid */ -}} {{- if .Store.Get "hasMermaid" -}} + {{- $config = dict "themes" .Site.Params.mermaid.themes | dict "mermaid" | merge $config -}} {{- end -}} diff --git a/layouts/partials/init/index.html b/layouts/partials/init/index.html index eb2646fe..349ea2af 100644 --- a/layouts/partials/init/index.html +++ b/layouts/partials/init/index.html @@ -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" . -}}