Skip to content

Commit

Permalink
load mermaid js asynchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidVollmers committed Nov 26, 2023
1 parent dd7957e commit c8b6869
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion website/Ignis.Website.WebAssembly/wwwroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<meta name="theme-color" content="#ffffff" />
<title>Ignis</title>
<base href="/" />
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script async type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script defer type="text/javascript" src="_content/Ignis.Components.Web/min.js"></script>
<script defer type="text/javascript" src="_content/Ignis.Website/js/website.min.js"></script>
<link href="_content/Ignis.Website/css/blazor.css" rel="stylesheet" />
Expand Down
9 changes: 9 additions & 0 deletions website/Ignis.Website/Scripts/website.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import './theme'
window.OnPageLoad = () => {
Prism.highlightAll()

const interval = setInterval(() => {
if (window.mermaid) {
initMermaid()
clearInterval(interval)
}
}, 100)
}

function initMermaid() {
const isDarkMode = getTheme() === '2'
mermaid.init(
{
Expand Down

0 comments on commit c8b6869

Please sign in to comment.