Strict security and offline export
Directive whitelists are per diagram type: flowchart allows flowchart/subgraph/direction/style, sequence allows participant/Note/loop/alt, class allows class/direction/namespace, and gantt allows title/dateFormat/section.
click, %%{init}, <script>, foreignObject, inline event handlers, javascript: URIs, dynamic import, fetch and external links are rejected before parsing; rejection messages never include raw source. Generated SVG escapes all text and contains no <a>, script or remote href.
Rendering and export stay local when offline; network.requests is empty and the plan explicitly avoids mermaid.ink and Kroki. The PNG plan requires rasterizing the SVG into a canvas and sampling pixels (ink count, ink ratio, at least two distinct colors) before export is allowed; a blank canvas is discarded with an error.