Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

API Reference

The Rust API reference is generated by cargo doc and published alongside this book at:

/afm/api/

afm crates (this repo)

These are the crates published from the afm workspace. They compose the sibling aozora-* parser into a Markdown integration layer.

  • afm_markdown — public entry points: render_to_string, render_to_ir, render_blocks_to_ir, serialize, plus Options (with afm_default / commonmark_only / gfm_only factories) and the IrDocument / IrBlock / IrInline tree under afm_markdown::ir.
  • afm_wasm#[wasm_bindgen] surface used by afm-obsidian and other browser hosts. The IR is serialised through serde-wasm-bindgen and matches the TypeScript IRDocument declared in afm-obsidian/src/ir/types.ts.
  • afm-cli — the afm binary. No library API; see CLI Reference for invocation details.

Sibling crates (aozora repo)

Pulled in as a git dependency from P4suta/aozora. Their published rustdoc lives on that repo’s GitHub Pages site; afm just embeds the returned types in its own surface.

  • aozora_pipeline — the lex driver. lex_into_arena(src, &arena) produces the BorrowedLexOutput (normalized text + Registry of borrowed AozoraNode payloads + diagnostics) that afm-markdown consumes.
  • aozora_syntax — the borrowed AST: AozoraNode, Container, ContainerKind, BoutenKind, BoutenPosition, AozoraHeadingKind, Indent, AlignEnd, SectionKind, plus the arena types (Arena, NonEmpty, Registry, NodeRef).
  • aozora_render — per-node HTML writer (render_node::render) and the source-level serializer (serialize::serialize). afm invokes the writer once per sentinel during HTML splicing.
  • aozora_encoding — Shift_JIS decoder (decode_sjis) and the gaiji resolution table.
  • aozora_specDiagnostic, Severity, DiagnosticSource, Span, sentinel codepoint constants.

Local preview

When viewing this handbook locally (e.g. via just book-serve) the API link above will 404 — run cargo doc --workspace --no-deps and mount the resulting target/doc/ at /afm/api/ to mirror the published Pages layout, or visit the published site at https://p4suta.github.io/afm/api/ directly.