Goal
Render ` ```mermaid ` fenced code blocks as actual SVG diagrams using Mermaid, fully offline, no CDN.
Why
Mermaid is the dominant diagram-as-code language for Markdown docs. GitHub renders these natively, so users expect to see diagrams when reading the same files locally.
Proposed approach
Optimizations to consider
- Lazy load. Only inject `vendor/mermaid.min.js` when the parsed output contains a `language-mermaid` block. Saves the 2 MB on docs without diagrams. Must stay extension-local — load via dynamic `<script>` pointing at `chrome.runtime.getURL(...)`, never a CDN.
- Cache rendered SVGs keyed by source hash to avoid re-rendering on every toggle.
Constraints
- No CDN. Mermaid bundled and shipped locally.
- Watch for CSP violations — Mermaid uses runtime `<style>` injection.
Acceptance criteria
Goal
Render ` ```mermaid ` fenced code blocks as actual SVG diagrams using Mermaid, fully offline, no CDN.
Why
Mermaid is the dominant diagram-as-code language for Markdown docs. GitHub renders these natively, so users expect to see diagrams when reading the same files locally.
Proposed approach
Optimizations to consider
Constraints
Acceptance criteria