Commit 55281a5
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: Tyler Gray <tylerg@emergentsoftware.net>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 78e8006 commit 55281a5
2 files changed
Lines changed: 85 additions & 0 deletions
File tree
- src
- tests/components
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
53 | 93 | | |
54 | 94 | | |
55 | 95 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
379 | 379 | | |
380 | 380 | | |
381 | 381 | | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
382 | 427 | | |
383 | 428 | | |
384 | 429 | | |
| |||
0 commit comments