Fix ODT comments leaking into paragraph text

CR
2d ago
+54-1

ODT comments currently become part of the paragraph they annotate. On the reproduction in #203, Lamb + comment + daword becomes LambAuthor2026-01-01T00:00:00COMMENTTEXTdaword. This change keeps Lambdaword intact and omits the comment's author, date, and body.

walk_inlines checked for annotation in the text namespace, while ODF comments use the office namespace. Skip that subtree before recursing into inline children. The check uses the resolved namespace URI, so alternate XML prefixes work too.

Two integration tests construct ODT ZIPs and call to_markdown_bytes: a point comment inside a word, and a ranged comment inside a link/span using an alternate prefix. They check that adjacent text and the link survive. Both tests fail before the production fix and pass afterward.

Related to #203. This fixes the annotation portion only; nested list numbering is unchanged and the issue should remain open for that work.

Validation on macOS arm64:

  • cargo test --locked: 300 passed, 1 existing ignored local-samples test.
  • cargo fmt --all --check: passed.
  • PYO3_PYTHON=/opt/homebrew/opt/python@3.12/bin/python3.12 cargo clippy --locked --workspace --all-targets --all-features -- -D warnings: passed.
  • The original issue's ODT fixture now converts to Text with a comment on Lambdaword here.
  • Separate review and rerun of the two new regression tests: passed.

AI assistance was used for implementation, testing, and review. Node, Python, and Wasm runtime suites were not run locally; upstream CI remains the cross-platform check.


Summary by cubic

Fixes ODT comments leaking into the paragraph they annotate. Previously, a comment between Lamb and daword produced LambAuthor2026-01-01T00:00:00COMMENTTEXTdaword; now the adjacent text stays intact and the comment's author, date, and body are omitted.

  • walk_inlines only checked text-namespace annotation elements, while ODF comments use the office namespace. Skip that subtree before recursing into inline children; the check uses the resolved namespace URI, so alternate prefixes work too.
  • Adds two integration tests covering a point comment inside a word and a ranged comment inside a link; both fail before this fix and pass after. This addresses only the annotation part of #203; nested list numbering is unchanged, and the issue stays open for that work.