Skip to content

Fix missing columns in Markdown tables without outer pipes - #302

Open
unknowlei wants to merge 1 commit into
virattt:mainfrom
unknowlei:fix/markdown-table-outer-pipes
Open

unknowlei wants to merge 1 commit into
virattt:mainfrom
unknowlei:fix/markdown-table-outer-pipes

Conversation

@unknowlei

Copy link
Copy Markdown

A table like this currently shows only the Revenue column, with Acme under it and the numbers missing:

Name | Revenue | Profit
--- | --- | ---
Acme | 100 | 20

The header parser was always dropping the first and last split cells. This only removes them when the line actually starts or ends with a pipe, so tables with either, both, or neither outer pipe keep their columns.

I added seven focused tests covering those four forms and empty header cells, including the rendered output. bun test ./src/utils/markdown-table.test.ts passes; the three cases with missing outer pipes failed before the fix.

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.

1 participant