mysite/static/js/init-mermaid-umd.js

21 lines
573 B
JavaScript

(function () {
function render() {
const nodes = document.querySelectorAll('.mermaid');
console.log('[mermaid] nodes on page:', nodes.length);
if (!window.mermaid) {
console.error('[mermaid] window.mermaid is missing');
return;
}
window.mermaid.initialize({ startOnLoad: false });
window.mermaid.run({ querySelector: '.mermaid' });
console.log('[mermaid] run() called');
}
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', render, { once: true });
} else {
render();
}
})();