Commit 8e7e77f
fix(formatters): fix HTML entities and escaped underscores in table output (#313)
## Summary
Fixes two rendering bugs introduced in `efb59ba` (the markdown rendering
pipeline):
1. **`<unknown>` displays as `<unknown>`** —
`escapeMarkdownInline` used HTML entities to escape angle brackets, but
`marked` keeps them as-is in text tokens, so they showed up literally in
terminal output.
2. **`/_astro/` displays as `/\_astro/`** — escaped underscores in URLs
got captured by GFM autolink detection, which doesn't process backslash
escapes, leaving the backslash visible.
## Changes
- `escapeMarkdownInline` / `escapeMarkdownCell`: use CommonMark
backslash escapes (`\<`/`\>`) instead of HTML entities. `marked`
correctly parses these as `escape` tokens with the decoded character.
- `renderOneInline` link case: detect GFM autolinks via `link.raw`
(starts with URL scheme, not `[`) and strip backslash-escape artifacts
from both link text and href.
- Tests: added angle bracket escape tests for both functions, plus
round-trip tests verifying `<unknown>` and URLs with underscores render
correctly through the full pipeline.
## Test plan
- `bun test test/lib/formatters/markdown.test.ts` — 77 tests pass (3
new)
- Manual: `bun src/bin.ts issue list` against projects with `<unknown>`
titles and URL-containing titles
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent efb59ba commit 8e7e77f
File tree
2 files changed
+47
-10
lines changed- src/lib/formatters
- test/lib/formatters
2 files changed
+47
-10
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | | - | |
91 | | - | |
| 90 | + | |
| 91 | + | |
92 | 92 | | |
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
97 | 97 | | |
98 | | - | |
99 | | - | |
100 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
110 | | - | |
111 | | - | |
| 110 | + | |
| 111 | + | |
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| |||
320 | 320 | | |
321 | 321 | | |
322 | 322 | | |
323 | | - | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
324 | 334 | | |
325 | | - | |
| 335 | + | |
326 | 336 | | |
327 | 337 | | |
328 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
316 | 320 | | |
317 | 321 | | |
318 | 322 | | |
| |||
479 | 483 | | |
480 | 484 | | |
481 | 485 | | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
482 | 509 | | |
483 | 510 | | |
484 | 511 | | |
| |||
0 commit comments