Skip to content

feat(ir): first-class IR exposure for the new aozora nodes #83

@P4suta

Description

@P4suta

Part of #81. Gated on the next aozora pin bump that crosses feat/devex-inner-loop.

Goal

Expose the new aozora nodes as first-class afm IR (decision: full IR
exposure), so the Obsidian/playground consumers can treat them as
structure, not just HTML. Today crates/afm-markdown/src/ir/projection.rs
drops unknown nodes via the _ => wildcard, so new constructs appear in
HTML but not in IrDocument.

New borrowed AozoraNode variants to project (re-confirm at pinned SHA)

From feat/devex-inner-loop crates/aozora-syntax/src/borrowed/types.rs:
AngleQuote (was DoubleRuby), Center, Emphasis, SideNote are new;
AozoraHeading and Sashie pre-existed but currently drop from IR. New
ContainerKind: Bold, Italic, Center, Columns, Table,
LineWidth, WrapIndent, Heading.

Work

  1. crates/afm-markdown/src/ir/projection.rs — replace the relevant
    _ => None drops with real arms.
    • Low-risk path for containers: the family
      (Columns/Table/LineWidth/WrapIndent/Bold/Italic/Center/
      Heading) can be exposed by extending container_subtype()
      (projection.rs:205-213) to return new camelCase subtype strings on
      the existing IrBlock::Containerno new IR variant needed.
      Decide whether LineWidth/Columns should also carry a numeric
      param via container_indent_level() (projection.rs:215-224).
    • Leaf nodes (Center, Emphasis, SideNote, Sashie,
      AozoraHeading): map to existing IrInline/IrBlock variants where
      natural (e.g. EmphasisIrInline::Strong/Emphasis?,
      AozoraHeadingIrBlock::Heading?) or add new variants where the
      CommonMark mapping would lose information.
  2. crates/afm-markdown/src/ir/types.rs — add any new
    IrInline/IrBlock variants (camelCase serde tags). Includes the
    IrInline::DoubleRuby → AngleQuote rename from feat: adapt to aozora DoubleRuby→AngleQuote rename on next pin bump #73 (types.rs:201).
  3. crates/xtask/src/types.rs — TS wire strings for the new shapes
    (xtask:141/286/430 currently carry doubleRuby).
  4. Regenerate crates/afm-wasm/types/afm_types.d.ts via xtask (do not
    hand-edit).
  5. playground/src/editor/{decorations.ts,wrapCommands.ts}
    decoration class map + authoring wrap commands for the new constructs.
  6. Extend crates/afm-markdown/examples/ast-walk.rs match arms
    (ast-walk.rs:61 currently names DoubleRuby).

Tests

crates/afm-markdown/tests/{ir_aozora.rs,ir_coverage.rs} — one IR-shape
assertion per new variant/subtype.

Decide each leaf node's mapping deliberately; map to existing IR only
when no information is lost. Re-confirm variant names at the pinned SHA.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deferredIntentionally postponed / not-yet-done; backlogenhancementNew feature or requestrustPull requests that update rust code

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions