<script type="module">
  import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
  mermaid.initialize({ startOnLoad: true, theme: 'dark' });
</script>
<script type="module">
  // Convert GitHub-style ```mermaid code blocks to <pre class="mermaid"> for rendering
  document.addEventListener('DOMContentLoaded', () => {
    document.querySelectorAll('pre > code.language-mermaid').forEach(el => {
      const pre = el.parentElement;
      const div = document.createElement('pre');
      div.className = 'mermaid';
      div.textContent = el.textContent;
      pre.replaceWith(div);
    });
    mermaid.run();
  });
</script>
