Skip to content

Commit

Permalink
style: try to fix after mermaid render callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Bonfitto committed Mar 12, 2024
1 parent 730edb9 commit 9ba6608
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/libs/mermaid.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@ module.exports = (eleventyConfig, options) => {
import mermaid from "${src}";
const config = ${JSON.stringify(mermaid_config)};
config.theme=isDarkMode()?'dark':'default';
mermaid.initialize(config);
await mermaid.run({suppressErrors: true});
if (afterMermaidRenderCallback != undefined)
{
afterMermaidRenderCallback();
}
document.addEventListener("DOMContentLoaded", function (event) {
mermaid.initialize(config);
await mermaid.run();
if (afterMermaidRenderCallback != undefined)
{
afterMermaidRenderCallback();
}
});
</script>`
});
return {}
Expand Down

0 comments on commit 9ba6608

Please sign in to comment.