Skip to main content

render_to_string

Function render_to_string 

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

Render afm source text to HTML.

One-stop entry point for the typical caller (afm CLI, afm-epub). Internally:

  1. [aozora_pipeline::lex_into_arena] turns the source into a normalized text (with PUA sentinels at every Aozora construct) plus a borrowed Registry.
  2. comrak::parse_document + comrak::format_html runs against the normalized text — sentinels flow through as plain text since they are not in CommonMark’s escape set (</>/&/").
  3. The internal post_process module sweeps the produced HTML, substituting each sentinel with the matching aozora_render::render_node output.

§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.