Repository navigation
fix(whatsnew): render GFM tables in release notes (#235) - #238
Merged
Merged
Conversation
Closes #235. ## What was wrong `WhatsNewModal`'s hand-rolled `renderMarkdown()` handled headers, bold, italic, code blocks, inline code, links, and bullet lists — but had no table support. GFM tables in release notes (e.g. the "Download" platform table in `release.yml`) fell through and rendered as raw markdown pipes: | Platform | Download | |----------|----------| | Windows | .msi | ## Fix Added a table-handling step in `renderMarkdown` between the list wrapping and newline conversion. Parses the standard GFM 3-part shape — header line, separator line, one-or-more body lines — and emits a styled `<table>` with `<thead>` / `<tbody>`. Honors column alignment specifiers (`:---`, `:---:`, `---:`) via inline `text-align` style. Matched Tailwind classes to the rest of the modal's palette (gray-200/700 borders for the header row, gray-100/800 for body rows). The substitution runs BEFORE the `\n\n` → `</p><p>` and `\n` → `<br>` conversions so the table block's internal newlines survive long enough to be parsed. ## Regression tests added - `should render GFM tables in release notes (#235)` — renders a modal with a 2-column, 2-row table body and asserts the DOM has a real `<table>` with the right header/row counts and cell text. - `should honor table column alignment specifiers` — asserts left / center / right specifiers produce the corresponding `text-align` style on the header cells. ## Test plan - [x] `npx vitest run shared.test.ts` — 31/31 pass (29 + 2 new) - [x] `npm run check` — 53 errors (same as `main` baseline, no new type errors introduced) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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 #235.
What was wrong
WhatsNewModal's hand-rolledrenderMarkdown()handled headers, bold, italic, code blocks, inline code, links, and bullet lists — but had no table support. GFM tables in release notes (e.g. the Download platform table inrelease.ymllines 123–128) fell through and rendered as raw markdown pipes, which is what the issue reporter saw:Fix
Added a table-handling step in
renderMarkdownbetween the list wrapping and newline conversion. Parses the standard GFM 3-part shape (header line, separator line, one-or-more body lines) and emits a styled<table>with<thead>/<tbody>. Honors column alignment specifiers (:---,:---:,---:) via inlinetext-alignstyle. Tailwind classes match the rest of the modal's palette (gray-200/700borders for the header row,gray-100/800for body rows).Ordering note: the table substitution runs before the
\n\n→</p><p>and\n→<br>conversions, so the table block's internal newlines survive long enough to be parsed.Regression tests added
should render GFM tables in release notes (#235)— renders a modal with a 2-column, 2-row table body and asserts the DOM has a real<table>with the right header/row counts and cell text.should honor table column alignment specifiers— asserts:---/:---:/---:produce the correspondingtext-alignstyle on the header cells.Test plan
npx vitest run shared.test.ts— 31/31 pass (29 existing + 2 new)npm run check— 53 errors (same asmainbaseline; no new type errors introduced)🤖 Generated with Claude Code