You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Rich text composer turns underscores in pasted URLs and paths into asterisks #25180
I searched existing issues and did not find a duplicate.
I included enough detail to reproduce or investigate the problem.
Area
apps/web
Steps to reproduce
Leave the rich text composer on (the default).
Paste this into the composer:
Read https://example.com/_handle_/status/1 and open src/__test__.tsx
Send it, or select all in the composer and copy.
Expected behavior
The agent receives exactly what was pasted:
Read https://example.com/_handle_/status/1 and open src/__test__.tsx
Actual behavior
The composer shows handle in italics and test in bold with the underscores hidden, and the agent receives:
Read https://example.com/*handle*/status/1 and open src/**test**.tsx
The link is broken and the path does not exist.
The same happens whenever a draft is rebuilt from its stored Markdown: reload, thread switch, history recall, stash restore. A URL that was typed character by character, which fix(web): keep typed underscores literal in the rich text composer #19186 keeps literal, is rewritten the next time the draft is rebuilt.
Pasting into inline code splits the paste out of the span. Pasting a_b_ **c** inside `xy` gives `x`a_b_ **c**`y`.
Pasting see `**x**` now sends see **`x`** now.
Cause: parseInlineMarkdown in apps/web/src/composer-rich-text.ts has no notion of URLs, so /_handle_/ qualifies as emphasis, and appendInlineRuns in apps/web/src/composer-rich-text-doc.ts writes every italic as * and every bold as ** (RICH_TEXT_DELIMITERS), whatever produced it. Paste (handlePaste) and every draft rebuild (buildDocJson) go through that parser. The code span case comes from Tiptap's paste rules, which run again over text handlePaste already parsed; the composer's code mark does not exclude bold, so **x** inside the span becomes bold. The chat renders the same text correctly because GFM autolinks a URL before looking for emphasis.
Activity