fix(gui): exclude trailing Markdown emphasis delimiters from autolinked URLs (#197) - #210
Merged
Merged
Conversation
Owner
Author
|
CI baseline note for reviewers:
This is an existing |
…ed URLs (#197) Bare URLs wrapped in Markdown emphasis (**url**, *url*, ~~url~~) captured the closing delimiters in the link target, so Cmd-hover/Cmd-click on macOS underlined and tried to open an invalid destination like http://localhost:3003**. trimLinkCandidate now strips trailing * and ~ (the emphasis/strikethrough markers) alongside the punctuation and unmatched-closer trimming it already did, looping so interleaved runs like "...3003.**" are fully cleaned. Interior URL characters (http://a.com/x*y) and legitimately balanced parens (en.wikipedia.org/wiki/Foo_(bar)) are preserved. Tests: new chatLinks.test.ts (9 cases incl. the report's three, span end, and non-regression); full gui bun test 144/144; eslint clean. Refs #197 Co-Authored-By: blackfloofie <265516171+blackfloofie@users.noreply.github.com>
Adversarial coverage for trimLinkCandidate: stacked (`***`) and mixed (`~~*…*~~`) trailing emphasis strip fully, and a URL ending in a multi-byte glyph (accents, emoji) is preserved byte-for-byte — trimming only ever removes ASCII markers, so it can never cut a codepoint in half. Refs #197 Co-Authored-By: blackfloofie <265516171+blackfloofie@users.noreply.github.com>
justrach
force-pushed
the
fix/197-chatlinks-md-delimiters
branch
from
July 22, 2026 08:53
d1056cf to
bb623af
Compare
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.
Problem
Bare URLs wrapped in Markdown emphasis (
**url**,*url*,~~url~~) captured the closing delimiters in the link target. On macOS, Cmd-hover/Cmd-click then underlined the trailing markers and tried to open an invalid destination such ashttp://localhost:3003**.Markdown-rendered messages normally split strong spans first, but raw/plain-text paths (
ChatInlineText/getInlineTextSegments) pass the markers straight intogetChatLinkMatches.Fix
The matcher now recognizes a contiguous Markdown delimiter immediately before a bare URL and removes only the matching closing delimiter from the candidate. This keeps Markdown syntax outside the clickable span without stripping valid URL characters from unwrapped links.
**http://localhost:3003**http://localhost:3003*https://example.com*https://example.com~~https://example.com~~https://example.comhttps://example.com/path*https://example.com/~*https://example.com/path**https://example.com/path*The delimiter handling is URL-specific, so generic file/path candidate cleanup does not accidentally remove legitimate trailing markers.
Tests
bun test: 157 passed, 0 failed.bunx eslint src/components/chat/utils/chatLinks.ts src/components/chat/utils/chatLinks.test.ts: passed.bunx tsc -b: passed.*/~URL characters.Repository-wide
bun run lintremains blocked by eight pre-existing errors in unrelated GUI files. The Vite build also reaches the bundler but is blocked by the repository's existing missingesbuilddependency.Closes #197