Skip to content

feat: add tab stop parsing and improved tab rendering#121

Merged
developer0hye merged 4 commits into
mainfrom
feat/tab-stops
Mar 7, 2026
Merged

feat: add tab stop parsing and improved tab rendering#121
developer0hye merged 4 commits into
mainfrom
feat/tab-stops

Conversation

@developer0hye

@developer0hye developer0hye commented Mar 4, 2026

Copy link
Copy Markdown
Owner

Summary

  • add DOCX tab stop support end to end through IR, parsing, and Typst generation
  • preserve inherited style tab stops while applying paragraph-level overrides, including clear semantics for targeted tab positions
  • render explicit tab leaders and improve decimal-tab alignment for values with thousands separators and locale-specific decimal separators

Why

Word tab stops are inherited through styles, can be selectively cleared, and often depend on dotted leaders or decimal alignment. The initial implementation covered the basics but still replaced inherited stops wholesale and aligned decimal tabs on the first punctuation mark.

Key changes

  • add tab stop override resolution in the DOCX parser so paragraph-level tabs merge correctly with inherited style tabs
  • emit leader-filled tab gaps in Typst instead of plain spacing when the tab stop defines a leader
  • anchor decimal tabs on the actual decimal separator instead of the first . or ,
  • add parser, Typst generation, and render-path regression tests for tab inheritance, clear behavior, leaders, and decimal alignment

Test plan

  • cargo test -p office2pdf
  • GitHub Actions checks
  • Visual verification with DOCX containing tabbed content

Related: #111

developer0hye and others added 3 commits March 7, 2026 01:06
Parse custom tab stops from DOCX paragraph properties (position,
alignment, leader type) and render tabs as Typst #h() spacing
instead of raw tab characters. Falls back to Word's default 36pt
(0.5 inch) spacing when no tab stops are defined.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit 809ae8d into main Mar 7, 2026
14 checks passed
@developer0hye
developer0hye deleted the feat/tab-stops branch March 7, 2026 05:21
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