fix mermaid initialization
| | |
| | | } |
| | | |
| | | function gitPull(origin, branch) { |
| | | const flags = ["-s", "recursive", "-X", "ours"] |
| | | const flags = ["-s", "recursive", "-X", "ours", "--no-edit"] |
| | | spawnSync("git", ["pull", ...flags, origin, branch], { stdio: "inherit" }) |
| | | } |
| | | |
| | |
| | | sourcefile, |
| | | }, |
| | | write: false, |
| | | minify: true, |
| | | bundle: true, |
| | | platform: "browser", |
| | | format: "esm", |
| | |
| | | js.push({ |
| | | script: ` |
| | | import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs'; |
| | | mermaid.initialize({ startOnLoad: true }); |
| | | document.addEventListener('nav', async () => { |
| | | const darkMode = document.documentElement.getAttribute('saved-theme') === 'dark' |
| | | mermaid.initialize({ |
| | | securityLevel: 'loose', |
| | | theme: darkMode ? 'dark' : 'default' |
| | | }); |
| | | }); |
| | | `, |
| | | loadTime: "afterDOMReady", |
| | | moduleType: "module", |
| | |
| | | |
| | | &:has(> code.mermaid) { |
| | | border: none; |
| | | position: relative; |
| | | } |
| | | |
| | | & > code { |