🔧 Chore(i): Mermaid ZenUML is not enabled by default

This commit is contained in:
Cell
2025-08-13 10:20:23 +08:00
parent bf3fe68378
commit fe034a2a40
4 changed files with 16 additions and 8 deletions
+4 -4
View File
@@ -649,8 +649,8 @@ class FixIt {
});
await window.mermaid.run();
processing = false;
if (delayTask && delayTask instanceof Function) {
delayTask()
if (delayTask && typeof delayTask === 'function') {
await delayTask();
delayTask = null;
}
};
@@ -660,7 +660,7 @@ class FixIt {
el.replaceChild(el.nextElementSibling.content.cloneNode(true), el.firstChild);
el.removeAttribute('data-processed');
});
loadMermaid()
await loadMermaid();
};
this.switchThemeEventSet.add(() => {
@@ -670,7 +670,7 @@ class FixIt {
return;
}
// console.log('reload immediately');
reloadMermaid();
reloadMermaid().catch(console.error);
});
this.beforeprintEventSet.add(() => {
+5 -2
View File
@@ -702,9 +702,12 @@ mainSections = []
# See https://github.com/mermaid-js/mermaid
[params.mermaid]
# FixIt 0.4.0 | NEW Mermaid ESM module CDN source
cdn = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs"
# default is https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs
cdn = ""
# FixIt 0.4.0 | NEW ZenUML ESM module CDN source
zenuml = "https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs"
# default is empty, you can set it to a CDN source to enable ZenUML support
# e.g. https://cdn.jsdelivr.net/npm/@mermaid-js/mermaid-zenuml/dist/mermaid-zenuml.esm.min.mjs
zenuml = ""
# For values, see https://mermaid.js.org/config/theming.html#available-themes
themes = ["default", "dark"]
+6 -1
View File
@@ -131,7 +131,12 @@
{{- /* mermaid */ -}}
{{- if .Store.Get "hasMermaid" -}}
{{- $mermaid := .Param "mermaid" -}}
{{- $content := printf "import mermaid from %q; import zenuml from %q; await mermaid.registerExternalDiagrams([zenuml]); window.mermaid = mermaid;" $mermaid.cdn $mermaid.zenuml -}}
{{- $mermaidCDN := $mermaid.cdn | default "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" -}}
{{- $content := printf "import mermaid from %q;" $mermaidCDN -}}
{{- with $mermaid.zenuml -}}
{{- $content = printf "%v import zenuml from %q; await mermaid.registerExternalDiagrams([zenuml]);" $content . -}}
{{- end -}}
{{- $content = printf "%v window.mermaid = mermaid;" $content -}}
{{- dict "Content" $content "Attr" `type="module"` | dict "Page" $ "Data" | partial "store/script.html" -}}
{{- $config = dict "themes" $mermaid.themes | dict "mermaid" | merge $config -}}
{{- end -}}
+1 -1
View File
@@ -1,4 +1,4 @@
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250812094854-45f101a4" -}}
{{- hugo.Store.Set "version" "v0.4.0-alpha-20250813022026-bf3fe683" -}}
{{- .Store.Set "this" dict -}}
{{- partial "init/detection-env.html" . -}}