File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 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' ,
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 } ) ;
You can’t perform that action at this time.
0 commit comments