#2716: Fix #2678: markdown horizontal rules not rendering in web chat
app: web-ui
size: XS
Cluster:
Markdown Rendering Improvements
Fix #2678 markdown horizontal rule rendering in web chat
Ensure --- / *** / ___ are recognized as thematic breaks and add regression test.
<!-- greptile_comment -->
<h2>Greptile Overview</h2>
<h3>Greptile Summary</h3>
This PR attempts to fix missing markdown thematic breaks in the web chat UI by preprocessing message markdown in `ui/src/ui/chat/grouped-render.ts` (wrapping exact `---` / `***` / `___` lines with newlines before calling `toSanitizedMarkdownHtml`). It also adds a regression test in `ui/src/ui/markdown.test.ts` asserting that `toSanitizedMarkdownHtml` can produce an `<hr>` for an input containing `---`.
The change sits at the UI rendering layer (Lit templates) and feeds into the shared markdown sanitizer/renderer (`ui/src/ui/markdown.ts`, which uses `marked` + DOMPurify).
<h3>Confidence Score: 3/5</h3>
- Likely safe to merge, but may not fully fix the reported rendering bug in all real-world cases.
- Changes are small and localized, but the newline-padding logic is narrowly scoped (exact matches only) and the added test doesn’t exercise the actual UI preprocessing path, so there’s a meaningful chance the reported issue persists for common inputs/variants.
- ui/src/ui/chat/grouped-render.ts (thematic break preprocessing) and ui/src/ui/markdown.test.ts (test coverage for variants/UI path)
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</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
#15204: fix(ui): preserve angle-bracketed text in chat
by bufordtjustice2918 · 2026-02-13
86.4%
#6521: fix: addressed style issue for chat compose and thread on mobile
by spencer-rafada · 2026-02-01
79.2%
#9411: Fix: Web UI long message overflow causing unreadable text
by vishaltandale00 · 2026-02-05
78.8%
#16733: fix(ui): avoid injected newlines when tool output is hidden
by jp117 · 2026-02-15
78.6%
#3721: fix(ui): webchat not displaying chat responses
by maxmaxrouge-rgb · 2026-01-29
78.6%
#9237: Fix: WhatsApp QR code not rendering in chat
by vishaltandale00 · 2026-02-05
78.5%
#7316: fix: /chat dashboard performance
by felipcsousa · 2026-02-02
78.0%
#4249: fix(telegram): properly nest link tags inside bold/italic formatting
by pradeeppeddineni · 2026-01-29
77.7%
#20795: fix(markdown): prevent triple newlines after blockquotes
by novalis133 · 2026-02-19
77.6%
#13318: fix(agents): prevent sanitizeUserFacingText from rewriting conversa...
by hleliofficiel · 2026-02-10
77.6%