Skip to main content

Crate aozora_flavored_markdown

Crate aozora_flavored_markdown 

Source
Expand description

Aozora Flavored Markdown — CommonMark + GFM + 青空文庫記法.

Layers aozora-pipeline (青空文庫記法 borrowed-AST lexer) onto a vendored verbatim comrak so a single render call turns aozora-flavored-markdown source into HTML. Public entry points:

use aozora_flavored_markdown::{Options, render};

let rendered = render("彼は|青梅《おうめ》に行った。", &Options::default());
assert!(rendered.html.contains("<ruby>"));

§Pipeline

source                                   ── UTF-8 input
  │
  ▼ aozora::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
  │
  ▼ ast_splice::splice_into_ast          ── sentinel → aozora-render,
  │   · INLINE_SENTINEL → NodeValue::Raw inline node
  │   · BLOCK_LEAF paragraphs → NodeValue::Raw block node
  │   · BLOCK_OPEN/CLOSE paragraphs → container open/close raws
  │
  ▼ comrak::format_html                  ── vanilla, sentinel-free AST
  │
  ▼
HTML

Comrak is unmodified: the v0.52.0 verbatim tree carries no Aozora-aware code (ADR-0001 budget = 0).

Modules§

diagnostics
aozora-flavored-markdown’s own diagnostic surface.
html
HTML rendering convenience entry.
ir
Intermediate representation produced by crate::render_to_ir.
sentinels
PUA sentinel codepoints embedded by aozora_pipeline.

Structs§

Diagnostic
A non-fatal observation about a render.
Options
Parse-time configuration for render and friends.
Rendered
Output of render.
RenderedBlock
One block of render_blocks_to_ir’s output.
RenderedIr
Output of render_to_ir.
Span
Byte-offset range into the (sanitized) source, end-exclusive.

Enums§

DiagnosticSource
Origin axis of a Diagnostic: a user-input issue versus a library-internal invariant violation. Serialises to "source" / "internal".
Severity
How strictly a host should treat a Diagnostic. Serialises to the lowercase wire string ("error" / "warning" / "note").

Functions§

render
Render aozora-flavored-markdown source text to HTML.
render_blocks_to_ir
Per-block streaming render.
render_to_ir
Render aozora-flavored-markdown source to a structured IR + HTML + diagnostics.
serialize
Round-trip an aozora-flavored-markdown source through the lexer and back to canonical aozora-md-source text.