Skip to main content

render_to_ir

Function render_to_ir 

Source
pub fn render_to_ir(input: &str, options: &Options<'_>) -> RenderedIr
Expand description

Render afm source to a structured IR + HTML + diagnostics.

Mirrors render_to_string but additionally walks comrak’s AST to emit a typed ir::IrDocument. The IR is the canonical contract between afm-wasm and afm-obsidian’s TS renderers.

The IR covers the full Markdown side (paragraph, heading, blockquote, list, code, thematic break, table, image) and the full Aozora side (Ruby / DoubleRuby / Bouten / Tcy / Gaiji / Annotation / PageBreak / SectionBreak / Container); heading hints ([#「X」は大見出し]) promote their host paragraph to IrBlock::Heading so the IR shape matches the rendered HTML one-for-one.

§Panics

Panics if comrak::format_html fails to write into the internal String sink — String cannot fail as a fmt::Write, so this branch is unreachable in normal use.