fix(delta): detect GFM tables without leading/trailing pipes - #3432
Open
handnewb wants to merge 3 commits into
Open
fix(delta): detect GFM tables without leading/trailing pipes#3432handnewb wants to merge 3 commits into
handnewb wants to merge 3 commits into
Conversation
The table parser required pipes at both start AND end of every row (^\s*\|.*\|\s*$). GFM-compliant tables without outer pipes fell through to ParagraphBlock which joins lines with spaces, permanently destroying table structure during delta refreshes. Add a lenient fallback that: 1. Detects a separator line with 3+ dashes (with optional colons) 2. Checks that every non-separator line contains at least one pipe 3. Routes to _parse_table_block instead of ParagraphBlock This preserves tables like: Header | Header ---|--- Cell | Cell Closes vectorize-io#3361
ruff formatter (v0.14.9, project-pinned version) collapses multi-line list comprehensions into single-line expressions when they fit within the 120-char line limit.
The original regex r"^\s*\|?[\s:]*-{2,}..." had [\s:]* (zero or
more spaces/colons) between the optional pipe and dashes. A previous
edit accidentally changed it to [\s:] (exactly one), which would
break tables with separators like |---| (no space between pipe and
dashes). Restore the original * quantifier.
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
The table parser in
structured_doc.pyrequired pipes at both start AND end of every row (^\\s*\|.*\|\\s*$). GFM-compliant tables without outer pipes (e.g.Header | Header\n---|---\nCell | Cell) fell through toParagraphBlockwhich joins lines with spaces, permanently destroying table structure during delta refreshes.Changes (1 file, +25/-1 lines)
_parse_table_blockinstead ofParagraphBlockBefore/After
"Header | Header Cell | Cell"(paragraph)Closes #3361