Skip to content

feat: render shaded blockquotes as single-cell tables for true 4-sided padding#73

Merged
forest6511 merged 2 commits into
mainfrom
feature/quote-cell-padding
May 1, 2026
Merged

feat: render shaded blockquotes as single-cell tables for true 4-sided padding#73
forest6511 merged 2 commits into
mainfrom
feature/quote-cell-padding

Conversation

@forest6511
Copy link
Copy Markdown
Owner

Closes #72

Summary

  • Renders blockquotes with BackgroundColor + any padding as a single-cell, borderless w:tbl with w:tcMar for true 4-sided padding (twip precision, no 31pt cap, no page-margin clipping).
  • Adds 4-sided per-side padding fields on QuoteStyle / QuoteStyleConfig (PaddingTop/Right/Bottom/Left, twips).
  • Keeps PaddingSpace (uint, points) as a documented deprecated alias mapping to all four sides via EffectivePadding* getters — backward-compatible for all 13 loadable presets, including business.yaml (the only one using PaddingSpace), which now correctly gets left padding too.
  • Quote blocks without a background color, or without padding, keep the existing paragraph rendering path unchanged.

See docs/decisions/ADR-0004-quote-block-padding.md for the full rationale, alternatives considered, and migration plan.

Test plan

  • dotnet test — 315/315 passing (4 new cell-mode tests, 2 rewritten from paragraph assertions, 2 new StyleApplicator precedence tests, 1 vertical-text+cell, 1 empty-content-cell)
  • CLI conversion against all 13 loadable presets succeeds
  • business.yaml output verified to emit <w:tbl> with <w:tcMar> of 80 twips on all four sides (incl. left — the Issue Quote: PaddingSpace cannot express left-side padding #72 fix)
  • default.yaml (no BG) verified to stay in paragraph mode (0 tables, 7 <w:pBdr>)
  • Vertical-text mode + cell-mode integration verified

…d padding

Closes #72

Replaces the invisible-paragraph-border padding hack with w:tcMar on a
borderless single-cell w:tbl when BackgroundColor + any padding is set.
This eliminates the 31pt cap, removes the page-margin clipping risk on
narrow LeftIndent values, and finally adds left-side padding (the bug
reported in #72).

Quote blocks without a background color, or without padding, keep the
existing paragraph rendering path verbatim.

API additions on QuoteStyle / QuoteStyleConfig:
  PaddingTop, PaddingRight, PaddingBottom, PaddingLeft (uint, twips)
  EffectivePadding{Top,Right,Bottom,Left} (per-side > 0 wins, else PaddingSpace*20)
  HasAnyPadding

Backward compatibility:
  PaddingSpace (uint, points) retained as a documented deprecated alias
  filling all four sides via the EffectivePadding* getters. All 13 loadable
  presets convert successfully; business.yaml (the only preset using
  PaddingSpace) now correctly gets left padding too.

See docs/decisions/ADR-0004-quote-block-padding.md for the full rationale,
alternatives considered (LeftBorder hack, per-side LeftPaddingSpace, do
nothing), and migration plan.

Tests: 315 passing (4 new for cell-mode, 2 rewritten from old paragraph
assertions; 2 new in StyleApplicator covering precedence).
@codecov
Copy link
Copy Markdown

codecov Bot commented May 1, 2026

Codecov Report

❌ Patch coverage is 97.45223% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.16%. Comparing base (5e01f01) to head (62c66b1).
⚠️ Report is 3 commits behind head on main.

Files with missing lines Patch % Lines
...kdownToDocx.Core/OpenXml/OpenXmlDocumentBuilder.cs 97.12% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #73      +/-   ##
==========================================
+ Coverage   88.88%   89.16%   +0.27%     
==========================================
  Files          28       28              
  Lines        1449     1606     +157     
  Branches      183      205      +22     
==========================================
+ Hits         1288     1432     +144     
- Misses        122      128       +6     
- Partials       39       46       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Address Codecov patch coverage gap on PR #73:
- list rendering inside a padded shaded blockquote
- BorderPosition with multiple non-default sides ("top,bottom,right")
- inline code run inside cell-mode quote paragraph (ApplyInlineCodeFont)

Brings coverage of new lines in OpenXmlDocumentBuilder.cs to 100%.
@forest6511 forest6511 merged commit b2672c8 into main May 1, 2026
4 checks passed
@forest6511 forest6511 deleted the feature/quote-cell-padding branch May 1, 2026 00:56
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.

Quote: PaddingSpace cannot express left-side padding

1 participant