class

Hwaro::Content::Processors::HighlightingRenderer

Inherits Markd::HTMLRenderer / Markd::Renderer / Reference / Object

Custom HTML renderer that adds syntax highlighting support Extends Markd's HTMLRenderer to customize code block output

Constructors

new(options : Markd::Options, highlight_enabled : Bool = true, server_mode : Bool = false)
Source

Instance methods

code_block(node : Markd::Node, entering : Bool)

Override code_block to add highlighting-specific attributes

Source
code_block_body(node : Markd::Node, lang : String | Nil)

In server mode, emit pre-highlighted spans instead of plain escaped text. Falls back to the default escaped output when the language has no lexer (the language-* class is still present for styling).

When fence options (line numbers / hl_lines) are present AND active, the body is wrapped per-line instead — but ONLY in server mode; client mode keeps this exact byte-for-byte legacy body no matter what options were parsed (see code_block, which is what adds the data-* attributes for the client-side case).

Source