Skip to content

fix(happy-app): handle blank lines and empty cells in markdown table parser#730

Open
Yoowatney wants to merge 1 commit intoslopus:mainfrom
Yoowatney:fix/markdown-table-blank-lines
Open

fix(happy-app): handle blank lines and empty cells in markdown table parser#730
Yoowatney wants to merge 1 commit intoslopus:mainfrom
Yoowatney:fix/markdown-table-blank-lines

Conversation

@Yoowatney
Copy link

@Yoowatney Yoowatney commented Feb 23, 2026

Summary

Fixes #506

Two bugs in the markdown table parser:

  1. Blank lines between rows: LLMs often output tables with \n\n between rows. The parser stopped collecting at the first blank line, rendering each row as raw text.
  2. Empty cells filtered out: filter(cell => cell.length > 0) removed interior empty cells (e.g. | | Header1 | Header2 | lost the empty first column), causing column misalignment.

Changes

  • Skip blank lines when collecting table rows in parseTable
  • Add splitTableRow helper that strips only leading/trailing pipe artifacts while preserving interior empty cells
  • Add 5 unit tests covering both bugs

Test plan

  • 5 new tests pass (blank lines, empty cells, combined case)
  • All 444 existing tests pass
  • Verified visually in web dev server

…parser

LLMs often output markdown tables with blank lines between rows, which
caused the table parser to stop collecting lines and render them as raw
text. Also fix cell parsing to preserve interior empty cells instead of
filtering them out.
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.

Markdown tables do not render cleanly - empty cells cause column misalignment

1 participant