mermaid-protect.ts#
6 documented symbols. Read the signatures first, then expand each item for parameters, return types, and examples.
Reference#
modulemermaid-protectProtects generated static SVG content from rehype HTML5 parser corruption. rehypeParse + rehypeStringify converts <br /…
Protects generated static SVG content from rehype HTML5 parser corruption.
rehypeParse + rehypeStringify converts <br /> in SVG foreignObject to <br></br>, which HTML5 interprets as 2 <br> elements. Each rehype pass doubles them: 1 → 2 → 4 → 8 → 16.
This module extracts ox-mermaid and ox-graphviz SVG blocks into placeholders before rehype processing and restores them after.
interfaceMermaidSvgProtectionProtects generated static SVG content from rehype HTML5 parser corruption. rehy…
Protects generated static SVG content from rehype HTML5 parser corruption.
rehypeParse + rehypeStringify converts <br /> in SVG foreignObject to <br></br>, which HTML5 interprets as 2 <br> elements. Each rehype pass doubles them: 1 → 2 → 4 → 8 → 16.
This module extracts ox-mermaid and ox-graphviz SVG blocks into placeholders before rehype processing and restores them after.
Signature
export interface MermaidSvgProtectionMembers
Properties
| Name | Type | Description |
|---|---|---|
html |
string |
|
svgs |
Map<string, string> |
fnprotectMermaidSvgs(html: string): MermaidSvgProtectionExtract <div class="ox-mermaid">...</div> blocks and replace with HTML comment…
Extract <div class="ox-mermaid">...</div> blocks and replace with HTML comment placeholders that rehype will preserve.
Signature
export function protectMermaidSvgs(html: string): MermaidSvgProtectionParameters
-
htmlstring
Returns
fnprotectStaticDiagramSvgs(html: string): MermaidSvgProtectionExtract generated static diagram blocks and replace them with HTML comment plac…
Extract generated static diagram blocks and replace them with HTML comment placeholders that rehype will preserve.
Signature
export function protectStaticDiagramSvgs(html: string): MermaidSvgProtectionParameters
-
htmlstring
Returns
fnrestoreMermaidSvgs(html: string, svgs: Map<string, string>): stringRestore protected mermaid SVG blocks from placeholders.
Restore protected mermaid SVG blocks from placeholders.
Signature
export function restoreMermaidSvgs(html: string, svgs: Map<string, string>): stringParameters
-
htmlstring -
svgsMap<string, string>
Returns
string
fnrestoreStaticDiagramSvgs(html: string, svgs: Map<string, string>): stringRestore generated static diagram blocks from placeholders.
Restore generated static diagram blocks from placeholders.
Signature
export function restoreStaticDiagramSvgs(html: string, svgs: Map<string, string>): stringParameters
-
htmlstring -
svgsMap<string, string>
Returns
string