My aggregated monorepo of OCaml code, automaintained
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix mermaid SPA: don't mark elements before mermaid.js loads

renderAll() was marking pre.mermaid elements with data-mermaid-init
even when the mermaid CDN script hadn't loaded yet. When mermaid
finally loaded and the MutationObserver fired, the elements were
already marked and skipped. Now renderAll() returns early if
mermaid is not yet defined.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+1
+1
odoc-mermaid-extension/src/mermaid_extension.ml
··· 239 239 240 240 function renderAll() { 241 241 initMermaid(); 242 + if (typeof mermaid === 'undefined') return; 242 243 var pending = document.querySelectorAll('pre.mermaid:not([data-mermaid-init])'); 243 244 if (pending.length === 0) return; 244 245 pending.forEach(function(el) {