class

Hwaro::Content::Processors::HookedRenderer

Inherits Hwaro::Content::Processors::HighlightingRenderer / Markd::HTMLRenderer / Markd::Renderer / Reference / Object

Renderer used only when at least one templates/hooks/render-* template is configured (RenderHooks.registry is non-nil). Every override starts with return super unless @hooks.<hook>?, so an element the registry has no hook for renders exactly as HighlightingRenderer would — this class adds no branches to the stock class itself.

Link/Image/Heading are containers (Markd's walker visits them twice: entering, then leaving with their children already rendered in between); the hook needs the children's rendered HTML as a single string, so push_capture/pop_capture temporarily swap @output_io/@last_output (the same buffer Markd::Renderer#literal/#output write to) for a scratch buffer, nesting correctly via @capture_stack for e.g. a link inside a heading, or an image inside a link.

Constants

ADMONITION_START_RE = /\A\s*<p>\[!(#{MarkdownExtensions::ADMONITION_TYPES.join('|')})\]/

Matches the first paragraph of a rendered admonition blockquote (&gt; [!NOTE] ...). Built from the same type list the postprocess regex uses, so the two can't drift apart.

Constructors

new(options : Markd::Options, highlight_enabled : Bool, server_mode : Bool, hooks : Content::Processors::RenderHooks::HookRenderContext)
Source

Instance methods

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

CodeBlock is a leaf — the walker yields exactly one (entering: true) event for it, matching HighlightingRenderer#code_block.

Source
heading(node : Markd::Node, entering : Bool)
Source
image(node : Markd::Node, entering : Bool)

Mirrors Markd::HTMLRenderer#image's @disable_tag protocol exactly (see the module doc above): a link or another image nested inside this image's alt text never gets its own tag, and neither does a nested hook — it just contributes plain text to this image's alt, same as stock.

Source