Skip to content

fix(docx): list export resolves markers through the shared PDF rules#164

Merged
DemchaAV merged 1 commit into
developfrom
fix/docx-list-parity
Jun 11, 2026
Merged

fix(docx): list export resolves markers through the shared PDF rules#164
DemchaAV merged 1 commit into
developfrom
fix/docx-list-parity

Conversation

@DemchaAV

Copy link
Copy Markdown
Owner

What

Two PDF ↔ DOCX list divergences found by the post-merge review of #161:

  1. Nested fallback: DocxSemanticBackend.writeNestedItem fell back to the flat-list marker, while the fixed-layout pipeline uses the depth cascade (·) — the same session produced ◦ child in PDF and • child in Word.
  2. Flat-item normalization skipped: the DOCX path glued marker.prefix() onto raw item text, so an author-typed "- item" doubled up as "• - item" and blank items emitted marker-only paragraphs (the PDF path strips typed markers and skips blanks via normalizeListItem).

How

Marker knowledge gets one owner in the node package: ListMarker.defaultForDepth(int) and ListMarker.normalizeItemText(String, boolean) (@since 1.8.0). TextFlowSupport and DocxSemanticBackend both delegate; the two private copies in TextFlowSupport are deleted.

Verification

  • 6 new DocxListParityTest cases: depth cascade, explicit markerFor precedence, author-typed marker stripping (-//*/+), **bold not mistaken for a marker, blank items dropped, normalizeMarkers(false) raw mode.
  • 2 DocxSemanticBackendTest expectations updated — they pinned the old divergent behavior (the comments now explain the parity contract).
  • Committed word-export-companion.docx preview verified content-stable (its depth-0 hits the cascade bullet either way; depths 1–2 are markerFor-baked) — no asset churn.
  • Full gate: ./mvnw verify -pl . — BUILD SUCCESS.

The semantic Word backend fell back to the flat-list marker for nested items (PDF uses the depth cascade) and skipped flat-item normalization (author-typed '- item' doubled as '• - item'; blank items emitted marker-only paragraphs). Marker knowledge now has one owner in the node package - ListMarker.defaultForDepth(int) and ListMarker.normalizeItemText(String, boolean) (@SInCE 1.8.0) - and TextFlowSupport and DocxSemanticBackend both delegate to it. Two DocxSemanticBackendTest expectations updated from the old divergent behavior to the parity contract; 6 new DocxListParityTest cases. Full verify: BUILD SUCCESS.
@DemchaAV DemchaAV merged commit 84ef85a into develop Jun 11, 2026
11 checks passed
@DemchaAV DemchaAV deleted the fix/docx-list-parity branch June 11, 2026 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant