Fix colspan cells producing misaligned markdown table columns#12
Conversation
When a table cell has colspan>1, the table-cell Turndown rule now emits extra empty pipe-delimited columns (colspan-1 of them) so the rendered row always has the same column count as the separator and data rows. Previously a colspan="2" header like "mikethecoder" produced "| mikethecoder |" (1 column) while the separator and data rows had 2 columns, causing most markdown renderers to reject the table entirely. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
|
Auto-converted PR to Draft. Mark as Ready for Review when the PR is finished to trigger Claude review and the auto-merge gate. |
TypeScript Review✅ No TypeScript errors were found in these changes |
|
Claude finished @fantomc0der's task in 1m 17s —— View job Code Review
SummaryThe fix is correct, minimal, and well-targeted. Here's my analysis: Implementation ( The new cell rule mirrors the existing
One minor style nit (not a bug): the Test coverage
CLAUDE.md compliance
REVIEW: PASS |
Summary
colspan > 1now emit the correct number of pipe-delimited columns in the markdown output. A cell withcolspan="2"and text "mikethecoder" previously rendered as| mikethecoder |(1 column), causing the header row to be narrower than the separator and data rows. Markdown renderers reject tables with inconsistent column counts, so the table displayed as raw text instead of a rendered table.colspan - 1extra empty|cells after any cell that spans multiple columns, so every row has the same column count and the table renders correctly.| someuser | |and| Header | |instead of the old single-column forms).Approach
The change is in the
table-cellTurndown rule insrc/converters/html-to-markdown.ts. After computing the cell text, we read thecolspanattribute and append" |".repeat(colspan - 1)to the replacement string. The separator row was already correct (it usescountDirectCellswhich already accounts for colspan); only the cell rendering needed fixing.Test plan
bun testpasses (129 tests, 0 failures)| Header | |— colspan=2 header now has 2 columns| someuser | |— MemeJack-style table header now correctly spans 2 columns| Left | Right |,| Magic Number | 17 |) unaffectedbun run buildsucceeds🤖 Generated with Claude Code