Conversation
…pe artifacts in autolinks `escapeMarkdownInline` and `escapeMarkdownCell` were using HTML entities (`<`/`>`) to prevent `<tag>` from being parsed as HTML. But `marked` keeps entities as-is in text tokens, so `<unknown>` rendered literally as `<unknown>`. Switching to CommonMark backslash escapes (`\<`/`\>`) fixes this — `marked` emits them as `escape` tokens with the decoded char. Also fixes backslash-escaped underscores leaking into GFM autolinks. When a URL like `https://site.com/_astro/file.js` was escaped to `\_astro`, the GFM autolink detector captured the escaped form and preserved the backslash literally. Now `renderOneInline` detects autolinks via `link.raw` and strips escape artifacts from both the link text and href. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨
Bug Fixes 🐛Api
Other
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
Codecov Results 📊✅ 2272 passed | Total: 2272 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 3233 uncovered lines. Files with missing lines (1)
Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 80.05% 80.08% +0.03%
==========================================
Files 120 120 —
Lines 16218 16226 +8
Branches 0 0 —
==========================================
+ Hits 12983 12993 +10
- Misses 3235 3233 -2
- Partials 0 0 —Generated by Codecov Action |
Rename `unescape` to `stripEscapes` to avoid shadowing the global, remove unnecessary escape/character from regex char class, and collapse arrow function to a single line. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
The biome lint fix in 91f35df accidentally dropped \] from the stripEscapes regex. This restores it so all 8 characters escaped by escapeMarkdownInline are correctly unescaped in autolinks. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <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.
Summary
Fixes two rendering bugs introduced in
efb59ba(the markdown rendering pipeline):<unknown>displays as<unknown>—escapeMarkdownInlineused HTML entities to escape angle brackets, butmarkedkeeps them as-is in text tokens, so they showed up literally in terminal output./_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.markedcorrectly parses these asescapetokens with the decoded character.renderOneInlinelink case: detect GFM autolinks vialink.raw(starts with URL scheme, not[) and strip backslash-escape artifacts from both link text and href.<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)bun src/bin.ts issue listagainst projects with<unknown>titles and URL-containing titles