fix(pdf): keep wrapped PDF table cells in their rows - #85
Conversation
Short row rules were dropped (MIN_RULE 24pt), so wrapped cells split across GFM tables and headers leaked as body text. Fold continuation lines into column bands, keep short gridlines, and assign cells by edges instead of column centers. fixes #75
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
mdgate-demo | 0b59ab7 | Aug 26 2026, 07:48 AM |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: Two-column wrap detection fails
- inferColumns now divides matching two-column rows by full.length so wrap lines no longer dilute the 0.5 threshold.
- ✅ Fixed: Short wraps split table rows
- startsRow now folds a single-column wrap into a cell that already has text, so short capitalized suffixes stay in the same row.
You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 188cffd. Configure here.
There was a problem hiding this comment.
Stale comment
Left a non-blocking comment and did not approve. Cursor Bugbot was present, then skipped, and its review still reports 2 unresolved medium-severity findings that need human attention. No reviewers were assigned because the only assignable user is the PR author.
Sent by Cursor Approval Agent: Pull Request Router and Approver
Score two-column consistency against full rows only so wrap lines do not drop the table. Fold a single-column wrap into a cell that already has text, including short proper-noun and suffix lines.



Confirmed against the opendataloader-bench pages in #75. Cell assignment in
packages/pdf/src/tables.tsdropped short row rules and treated wrapped lines as new rows, so headers leaked, multi-line cells split, and one grid became several GFM tables.Changes
Checks
01030000000081: TABLE 22 header and the wrapped Food Safety row stay in one 3-column table01030000000045/46: org/party names and counts stay in columns01030000000088–90: country, Y/N, and restriction text stay in one gridpdf/text.pdfsnapshot unchangedbun testandbun run lintpassfixes #75
Note
Medium Risk
Heuristic changes in table detection may mis-classify some PDF layouts (false tables or merged prose), though scope is limited to markdown output from
packages/pdf.Overview
Fixes PDF table extraction where wrapped text and partial ruling were split into extra rows or multiple GFM tables instead of one grid.
Ruled grids: lowers minimum rule length (
MIN_RULE24→12), extends column edges from horizontal rule extents, and when there are columns but fewer than two row bands, falls back tobuildTextGrid(aligned-text folding) instead of rejecting the grid. Bounds use vertical rule extents where relevant.Borderless / aligned tables: extends row runs with
isContinuation(column alignment, caption skip, wrap span), thenfoldRowsmerges continuation lines into the current logical row via column bands (columnIndex/ edges) andstartsRowheuristics (keys, totals, lowercase wraps). Column inference is split intoinferColumns+finishAlignedTable.acceptGridandacceptBorderlessare relaxed so one long column and larger tables (higher word/row limits) can still pass—e.g. Y/N plus restriction paragraphs stay one table.Adds regression tests for short vertical rules, wrapped headers/cells, two-column wraps, and multi-column GATS-style grids.
Reviewed by Cursor Bugbot for commit 0b59ab7. Bugbot is set up for automated code reviews on this repo. Configure here.