feat(format): preserve pipe table rows#130
Merged
barrettruth merged 1 commit intomainfrom Apr 4, 2026
Merged
Conversation
Problem: The formatter treats GFM-style pipe table rows as prose and reflows them into unreadable garbage. Any vimdoc file using markdown tables (e.g. fzf-lua, panvimdoc-generated docs) is destroyed on format. Solution: Add `is_pipe_table_row` check — lines that start and end with `|` are preserved verbatim, skipping both the reflow entry point and the paragraph collector. Covers padded (`| cell |`) and tight (`|cell|`) styles. Zero false positives on the Neovim/Vim runtime corpus (290 files); the only `| `-prefixed lines in those docs are inside code blocks or are short taglink-only lines that don't need reflow.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Closes #129.
Summary
is_pipe_table_rowheuristic to the formatter: lines that start and end with|(after trimming trailing whitespace) are preserved verbatimemit_prose_paragraphcollector now skip pipe table rows| cell | cell |) and tight (|cell|cell|) GFM-style tablesContext
The formatter was destroying every GFM pipe table in any vimdoc file — fzf-lua's 207 table lines were reflowed into unreadable garbage. The root cause: pipe table rows are unindented, tab-free
LineKind::Textlines, so they hit the prose reflow path.The heuristic has zero false positives on the combined Neovim (135 files) and Vim (155 files) runtime corpus. The only
|-prefixed lines in those docs are inside code blocks (already protected) or short taglink-only lines that don't need reflow.Traditional vimdoc tables (tab-aligned columns with
~headers) were already safe — the existingcontains('\t')check handles them.Test plan
cargo fmt --checkpassescargo clippy -- -D warningspassescargo test— all 142 tests pass (71 unit + 3 corpus + 7 format CLI + 50 integration + 11 server)prettier --check site/passes