Skip to content

Commit

Permalink
fix mermaid initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyzha0 committed Aug 5, 2023
1 parent 21a7ec2 commit 9e76b25
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 1 addition & 2 deletions quartz/bootstrap-cli.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ async function popContentFolder(contentFolder) {
}

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" })
}

Expand Down Expand Up @@ -334,7 +334,6 @@ See the [documentation](https://quartz.jzhao.xyz) for how to get started.
sourcefile,
},
write: false,
minify: true,
bundle: true,
platform: "browser",
format: "esm",
Expand Down
8 changes: 7 additions & 1 deletion quartz/plugins/transformers/ofm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,13 @@ export const ObsidianFlavoredMarkdown: QuartzTransformerPlugin<Partial<Options>
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",
Expand Down
1 change: 1 addition & 0 deletions quartz/styles/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,7 @@ pre {

&:has(> code.mermaid) {
border: none;
position: relative;
}

& > code {
Expand Down

0 comments on commit 9e76b25

Please sign in to comment.