#15204: fix(ui): preserve angle-bracketed text in chat
app: web-ui
size: XS
Cluster:
Markdown Rendering Improvements
Fixes #15200. Escape angle brackets before markdown rendering so `/approve <id>` displays correctly in the web chat.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR updates the chat markdown rendering pipeline (`ui/src/ui/markdown.ts`) to pre-escape angle brackets (`<`/`>`) before handing text to `marked.parse`, so command-like strings such as `/approve <id>` display literally instead of being interpreted as HTML.
The change is localized to the UI markdown sanitizer and affects all consumers of `toSanitizedMarkdownHtml` (e.g. chat bubbles and the tool output sidebar).
<h3>Confidence Score: 4/5</h3>
- This PR is likely safe to merge and is narrowly scoped to UI markdown rendering.
- Change is small and localized (only escapes angle brackets before markdown parse) and still runs through DOMPurify sanitization. I could not execute marked/node locally in this environment to validate entity-handling behavior end-to-end, so there is a small residual risk of display regressions for inputs containing HTML entities.
- ui/src/ui/markdown.ts
<sub>Last reviewed commit: bc01ad9</sub>
<!-- greptile_other_comments_section -->
<sub>(5/5) You can turn off certain types of comments like style [here](https://app.greptile.com/review/github)!</sub>
**Context used:**
- Context from `dashboard` - CLAUDE.md ([source](https://app.greptile.com/review/custom-context?memory=fd949e91-5c3a-4ab5-90a1-cbe184fd6ce8))
- Context from `dashboard` - AGENTS.md ([source](https://app.greptile.com/review/custom-context?memory=0d0c8278-ef8e-4d6c-ab21-f5527e322f13))
<!-- /greptile_comment -->
Most Similar PRs
#2716: Fix #2678: markdown horizontal rules not rendering in web chat
by Ambar-13 · 2026-01-27
86.4%
#6521: fix: addressed style issue for chat compose and thread on mobile
by spencer-rafada · 2026-02-01
78.5%
#23073: fix(ui): strip reply directive tags from assistant messages in WebC...
by x4v13r1120 · 2026-02-22
78.5%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
78.4%
#9237: Fix: WhatsApp QR code not rendering in chat
by vishaltandale00 · 2026-02-05
78.3%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
77.8%
#22832: fix: strip [[reply_to_current]] directive from chat history
by willkriski · 2026-02-21
77.7%
#7316: fix: /chat dashboard performance
by felipcsousa · 2026-02-02
77.7%
#14940: fix(googlechat): convert Markdown formatting to Google Chat markup
by brandonwise · 2026-02-12
77.6%
#9411: Fix: Web UI long message overflow causing unreadable text
by vishaltandale00 · 2026-02-05
77.3%