Expand description
WebAssembly bindings for afm-markdown.
Exposes a thin set of #[wasm_bindgen] exports that
afm-obsidian (and other browser hosts) call across the WASM
boundary. The IR shape returned by render_afm and
render_aozora_only mirrors the TS IRDocument defined in
afm-obsidian/src/ir/types.ts and is validated on the JS side
by from-wasm.ts.
§Stability
Public exports here are version-pinned to afm-markdown’s workspace version. A bump on this crate implies an afm-obsidian recompilation against the new IR shape.
§Surface
init_panic_hook— opt-in panic forwarder (debug builds).render_afm— full afm pipeline (CommonMark + GFM + aozora).render_aozora_only— aozora-only inline mode (used by afm-obsidian’s inline post-processor; bypasses comrak).hash_source— xxh3-64 over the source, returned asu64for cache-key construction on the JS side.
Structs§
- Block
Result 🔒 - Blocks
Result 🔒 - Diagnostic
Out 🔒 - Wire-format projection of [
Diagnostic] for the JS side. - Render
Options 🔒 - Optional render configuration accepted from JS. All fields are
optional; missing fields fall back to
Options::afm_default()(aozora on, anchors off). - Render
Result 🔒 - Result envelope returned to JS. Matches the shape consumed by
afm-obsidian/src/ir/from-wasm.ts.
Functions§
- build_
options 🔒 - hash_
source - xxh3-64 over the source, returned as a
u64(JS receives abigint). Used for cache keys. - init_
panic_ hook - Install a
console.errorpanic hook for friendlier debugging. No-op when compiled without thepanic-hookfeature. - render_
afm - Render afm source to IR + HTML + diagnostics.
- render_
aozora_ only - Render aozora-only inline text (no markdown re-parse).
- render_
blocks - Per-block streaming render.