Summary
Bare URLs wrapped in Markdown bold markers can be parsed with the closing ** included in the URL. On macOS, Cmd-hover then underlines the trailing asterisks as part of the link and attempts to open an invalid target such as http://localhost:3003**.
Reproduction
Render or linkify this assistant response:
**http://localhost:3003**
The lower-level parser reproduces it directly:
cd gui
bun -e 'import { getChatLinkMatches } from "./src/components/chat/utils/chatLinks.ts"; console.log(getChatLinkMatches("**http://localhost:3003**"))'
Current result:
[{"kind":"url","start":2,"end":25,"value":"http://localhost:3003**"}]
Expected
The clickable target and underlined span should end at http://localhost:3003; Markdown delimiters must remain outside the URL.
Actual
The URL value includes the closing **, so Cmd-click/Cmd-hover treats the asterisks as part of the destination and the link cannot be opened correctly.
Likely cause
gui/src/components/chat/utils/chatLinks.ts uses:
const URL_PATTERN = /https?:\/\/[^\s"'`<>]+/giu;
* is accepted by that pattern, while trimLinkCandidate() removes punctuation and unmatched closing brackets but not Markdown emphasis delimiters. Markdown-rendered messages may normally split strong spans first, but raw/plain-text paths using ChatInlineText / getInlineTextSegments pass the markers directly to this matcher.
Suggested regression coverage
Add a getChatLinkMatches or rendered-component test covering URLs adjacent to Markdown delimiters, including:
**http://localhost:3003**
*https://example.com*
~~https://example.com~~
The matcher should preserve legitimate URL characters while excluding surrounding Markdown syntax.
Summary
Bare URLs wrapped in Markdown bold markers can be parsed with the closing
**included in the URL. On macOS, Cmd-hover then underlines the trailing asterisks as part of the link and attempts to open an invalid target such ashttp://localhost:3003**.Reproduction
Render or linkify this assistant response:
The lower-level parser reproduces it directly:
Current result:
[{"kind":"url","start":2,"end":25,"value":"http://localhost:3003**"}]Expected
The clickable target and underlined span should end at
http://localhost:3003; Markdown delimiters must remain outside the URL.Actual
The URL value includes the closing
**, so Cmd-click/Cmd-hover treats the asterisks as part of the destination and the link cannot be opened correctly.Likely cause
gui/src/components/chat/utils/chatLinks.tsuses:*is accepted by that pattern, whiletrimLinkCandidate()removes punctuation and unmatched closing brackets but not Markdown emphasis delimiters. Markdown-rendered messages may normally split strong spans first, but raw/plain-text paths usingChatInlineText/getInlineTextSegmentspass the markers directly to this matcher.Suggested regression coverage
Add a
getChatLinkMatchesor rendered-component test covering URLs adjacent to Markdown delimiters, including:**http://localhost:3003***https://example.com*~~https://example.com~~The matcher should preserve legitimate URL characters while excluding surrounding Markdown syntax.