Skip to content

Commit 43d1e21

Browse files
committed
Fix mermaid re-ini
1 parent 80884a3 commit 43d1e21

1 file changed

Lines changed: 20 additions & 10 deletions

File tree

docs/docs.html

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@
3333
<script>
3434
document.addEventListener('DOMContentLoaded', () => {
3535

36+
// Initialize mermaid once (startOnLoad: false — we drive rendering via the Docsify hook below)
37+
if (typeof mermaid !== 'undefined') {
38+
mermaid.initialize({
39+
startOnLoad: false,
40+
theme: 'dark',
41+
securityLevel: 'loose'
42+
});
43+
};
44+
3645
// Configure Docsify
3746
window.$docsify = {
3847
name: 'WebUI',
@@ -48,16 +57,17 @@
4857
theme : 'classic',
4958
tabComments: false,
5059
tabHeadings: true
51-
}
52-
};
53-
54-
// Initialize mermaid
55-
if (typeof mermaid !== 'undefined') {
56-
mermaid.initialize({
57-
startOnLoad: true,
58-
theme: 'dark',
59-
securityLevel: 'loose'
60-
});
60+
},
61+
plugins: [
62+
function(hook) {
63+
// Re-run mermaid after every page navigation
64+
hook.doneEach(function() {
65+
if (typeof mermaid !== 'undefined') {
66+
mermaid.run();
67+
}
68+
});
69+
}
70+
]
6171
};
6272

6373
});

0 commit comments

Comments
 (0)