fix(layout): respect section and table metrics#320
Open
juanmendez-git wants to merge 6 commits intoeigenpal:mainfrom
Open
fix(layout): respect section and table metrics#320juanmendez-git wants to merge 6 commits intoeigenpal:mainfrom
juanmendez-git wants to merge 6 commits intoeigenpal:mainfrom
Conversation
Use each DOCX section's page geometry during layout and preserve table/cell metrics so paged rendering better matches Word. Made-with: Cursor
|
@juanmendez-git is attempting to deploy a commit to the EigenPal Team on Vercel. A member of the Team first needs to authorize it. |
Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes DOCX pagination/layout mismatches where rendered output diverged from Word for documents with mixed sections, rendered page-break markers, and auto-fit tables.
The main issue was that layout treated page geometry too globally. Documents with multiple sections could render portrait/landscape pages, margins, and columns using the wrong section properties, which shifted content across pages. The fix applies each section’s own page size, margins, columns, and section start behavior during measurement and pagination.
Also preserves Word-rendered page-break markers through the parser, ProseMirror conversion, and flow layout. Paragraphs that Word places after
w:lastRenderedPageBreakor a leading hard page break now start on the expected page instead of being laid out on the previous page or overlapping footers.Improves auto-fit table rendering by normalizing incomplete or zero-width table grids, preserving cell width metadata, inferring full-row spans for single-cell rows, and accounting for paragraph spacing inside table cells during measurement/rendering.
Fixes #319
Why this is its own PR
These changes all target the same rendering correctness problem: matching Word’s document metrics during pagination. Keeping them together makes the behavior easier to validate against the affected DOCX because section geometry, page breaks, and table metrics all affect final page flow.
Test plan
bun run typecheck clean
bun test clean
bun run build clean
Evidence