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

Recipes

Task-shaped, copy-paste answers to “how do I do X with aozora?”. Each recipe is a single problem stated in one sentence, the minimal correct code to solve it, the output you should expect, and a jump list to the deeper chapters.

The Rust snippets use the umbrella aozora crate and nothing else — downstream consumers depend on aozora alone, never the internal build-block crates. The shell snippets use the aozora binary. If you have not yet got either in scope, start at Install, then the Library or CLI quickstart.

Each recipe that has a Rust solution maps to a runnable example under crates/aozora/examples/, so you can read the whole program and run it rather than reassembling fragments. Where that applies the recipe says so — e.g. run with just example walk_ast.

The recipes

I want to…Recipe
Pull every ruby base + reading pair out of a documentExtract ruby pairs
Get diagnostics as machine-readable JSONDiagnostics as JSON
Walk the parsed tree node by nodeWalk the AST
Parse a Shift_JIS file and resolve 外字Shift_JIS & gaiji
Convert to EPUB / LaTeX / DOCXEPUB via Pandoc
Check that a file is already canonicalRound-trip & fmt –check
Call aozora from Go / Java / Python / JSCall from another language

The example programs

The recipes mirror these runnable examples (authored under crates/aozora/examples/); each is launched with just example <name>:

ExampleMirrors
helloThe six-line render in the Library quickstart
walk_astWalk the AST, Extract ruby pairs
diagnosticsDiagnostics as JSON
round_tripRound-trip & fmt –check
sjisShift_JIS & gaiji

See also

  • Library Quickstart — the lifetime model and the core DocumentAozoraTree flow every recipe assumes.
  • Choosing a binding — picking the surface (Rust / CLI / wasm / Python / Go / Extism) before you start.
  • Node reference — what each AST node represents.
  • Wire format — the JSON envelope the aozora::wire serialisers emit.