Expand description
Aozora Flavored Markdown — CommonMark + GFM + 青空文庫記法.
Layers aozora-pipeline (青空文庫記法 borrowed-AST lexer) onto a
vendored verbatim comrak so a single render_to_string call
turns afm source into HTML. Public entry points:
render_to_string— render afm source straight to HTML.serialize— afm-source round-trip (delegates to [aozora_render::serialize::serialize]).Options— configuration;Options::afm_defaultenables the GFM extensions afm uses on top of CommonMark.
§Pipeline
source ── UTF-8 input
│
▼ aozora_pipeline::lex_into_arena ── normalized text + Registry
│
▼ comrak::parse_document ── vanilla CommonMark + GFM
│ (PUA sentinels U+E001..U+E004 flow through as plain text)
│
▼ comrak::format_html_with_options ── HTML with sentinels
│
▼ post_process::splice_aozora_html ── sentinel → aozora-render
│ · INLINE_SENTINEL → render_node::render output
│ · BLOCK_LEAF paragraphs → leaf node HTML
│ · BLOCK_OPEN/CLOSE paragraphs → container open/close
│
▼
HTMLComrak is unmodified: the v0.52.0 verbatim tree carries no Aozora-aware code (ADR-0001 budget = 0).
Modules§
- code_
block_ 🔒mask - Pre-/post-process pass that hides 青空文庫 trigger characters inside CommonMark fenced code blocks.
- html
- HTML rendering convenience entry.
- ir
- Intermediate representation produced by
crate::render_to_ir. - post_
process 🔒 - HTML post-processing: splice Aozora sentinels into rendered comrak HTML.
- sentinels 🔒
- Shared primitives for both
crate::post_process(HTML splicer) andcrate::ir(IR builder). - source_
line_ 🔒anchors - Source-line anchor injection for the HTML renderer.
Structs§
- Options
- Parse-time configuration for
render_to_stringand friends. - Rendered
- Output of
render_to_string. - Rendered
Block - One block of
render_blocks_to_ir’s output. - Rendered
Ir - Output of
render_to_ir.
Enums§
- Diagnostic
- Observation emitted by any lexer phase.
- Diagnostic
Source - Origin of a
Diagnostic— distinguishes user-input issues from library-internal sanity-check failures. - Severity
- Severity of a
Diagnostic.
Constants§
- BLOCK_
CLOSE_ SENTINEL - Paired-container close line (e.g.
[#ここで字下げ終わり]). - BLOCK_
LEAF_ SENTINEL - Block-leaf Aozora line (page break, section break, leaf indent, sashie).
- BLOCK_
OPEN_ SENTINEL - Paired-container open line (e.g.
[#ここから字下げ]). - INLINE_
SENTINEL - Inline Aozora span (ruby / bouten / annotation / gaiji / TCY / kaeriten).
Functions§
- collect_
rendered_ 🔒blocks - render_
blocks_ to_ ir - Per-block streaming render.
- render_
to_ ir - Render afm source to a structured IR + HTML + diagnostics.
- render_
to_ string - Render afm source text to HTML.
- serialize
- Round-trip an afm source through the lexer and back to canonical afm-source text.