Skip to main content

highlight_code_blocks

Function highlight_code_blocks 

Source
pub fn highlight_code_blocks(html: &str, theme: SyntaxTheme) -> String
Expand description

Highlight all <pre><code class="language-..."> blocks in rendered HTML.

Each recognized block is replaced with <div class="code-block-wrapper"><pre class="syntax-highlight" data-language="...">…</pre> plus a copy-to-clipboard button, matching the docs-site rendering pipeline. Blocks with unknown or unsupported languages are left untouched.