Skip to main content

process_diagram_code_blocks

Function process_diagram_code_blocks 

Source
pub fn process_diagram_code_blocks<'a>(root: &'a AstNode<'a>)
Expand description

Walks the comrak AST and replaces every NodeValue::CodeBlock whose info-string names mermaid with a NodeValue::HtmlBlock containing the sanitizer-safe <pre class="mermaid"> container.

Kind-matching is done on the first whitespace-delimited token of the info string so mermaid classDiagram still counts as mermaid. Non-mermaid code blocks pass through unchanged — the syntax highlighter still sees them downstream.