Feat: add Mermaid config

This commit is contained in:
Cell
2022-07-10 14:51:34 +08:00
parent e47abfde71
commit 01b1d40d6c
11 changed files with 33 additions and 7 deletions
+2 -1
View File
@@ -586,7 +586,8 @@ class FixIt {
this._mermaidOnSwitchTheme = this._mermaidOnSwitchTheme || (() => {
const $mermaidElements = document.getElementsByClassName('mermaid');
if ($mermaidElements.length) {
mermaid.initialize({startOnLoad: false, theme: this.isDark ? 'dark' : 'neutral', securityLevel: 'loose'});
const themes = this.config.mermaid.themes ?? ['neutral', 'dark'];
mermaid.initialize({startOnLoad: false, theme: this.isDark ? themes[1] : themes[0], securityLevel: 'loose'});
this.util.forEach($mermaidElements, $mermaid => {
mermaid.render('svg-' + $mermaid.id, this.data[$mermaid.id], svgCode => {
$mermaid.innerHTML = svgCode;