Skip to content

fix(docx): render paragraph shading - #382

Merged
developer0hye merged 1 commit into
mainfrom
fix/docx-paragraph-shading
Jul 21, 2026
Merged

fix(docx): render paragraph shading#382
developer0hye merged 1 commit into
mainfrom
fix/docx-paragraph-shading

Conversation

@developer0hye

Copy link
Copy Markdown
Owner

Summary

Paragraph-level shading (w:pPr/w:shd) was dropped: the CLI-manual fixture's shaded monospace code blocks rendered on plain white, indistinguishable from body text. docx-rs only parsed run and table-cell shading, so the docx-rs patch branch now reads paragraph shading (developer0hye/docx-rs#2, merged). office2pdf carries the fill through the IR (ParagraphStyle.background, style merge included) and paints it on the paragraph's full-width block wrapper.

Related issue

Fixes #351

Testing

  • cargo test --workspace — all green (perf suite re-run in isolation)
  • New tests: test_paragraph_shading_extracted_as_background (parser), test_generate_paragraph_with_background_shading (codegen), plus ParagraphStyle::merge_from coverage; docx-rs gains test_read_paragraph_shading
  • Converted 05_technical_manual_en.docx: all four code blocks now carry the light-gray background, matching the Word GT at 150 DPI

Visual impact

  • No rendered PDF change
  • Rendered PDF change or visual evidence added
  • Reason:

Visual audit

  • Issue: DOCX: paragraph shading (w:shd) is not rendered #351
  • Fixture: 05_technical_manual_en.docx (synthetic real-world audit set, external)
  • Page(s): 1
  • Renderer and DPI: pdftoppm, 150 DPI
  • Evidence mode: fix
  • New follow-up issues found in this audit: None
  • GT: assets/bugfixes/issue-351/gt.jpg
  • Before: assets/bugfixes/issue-351/before.jpg
  • After: assets/bugfixes/issue-351/after.jpg

Visual comparison

GT Before After
GT Before After

Required inspection

  • Rendered all evidence at 150 DPI or higher
  • Stored progressive JPEG quality 86 assets with metadata stripped
  • Inspected matched region crops at full resolution
  • Ran the 5% fuzz pixel-difference sweep
  • Inventoried hairlines and border dash styles
  • Inventoried font weight, italic, and underline emphasis

Deviation audit

Check Result
Page count/order Matches GT
Element presence Fixed (code-block shading present)
Position/size Matches GT
Rotation/flip No deviation observed
Fill Fixed
Stroke/border No deviation observed
Text content Matches GT (double hyphens verbatim since #381)
Font family/weight/style No deviation observed
Text color No deviation observed
Alignment Matches GT
Line/paragraph spacing Remaining: #354 (line pitch still larger than Word)
Clipping/overflow No deviation observed

Checklist

  • Commits include a Signed-off-by line
  • PR scope contains one root cause
  • Remaining visual deviations each reference an open issue

🤖 Generated with Claude Code

Word paints w:pPr/w:shd behind the whole paragraph (code-block
backgrounds); the fill was dropped. The docx-rs patch branch now parses
paragraph shading (developer0hye/docx-rs#2); carry it through the IR as
a paragraph background and fill the full-width block wrapper.

Signed-off-by: Yonghye Kwon <developer.0hye@gmail.com>
@developer0hye
developer0hye merged commit 5157978 into main Jul 21, 2026
15 checks passed
@developer0hye
developer0hye deleted the fix/docx-paragraph-shading branch July 21, 2026 19:33
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.

DOCX: paragraph shading (w:shd) is not rendered

1 participant