Rendered KaTeX also shows a garbled plaintext duplicate of the formula
- Dominant language
- TypeScript
- Stars
- 909
- Forks
- 116
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 156
Description
### Before filing
- [x] I searched [open and closed issues](https://github.com/block/berd/issues?q=is%3Aissue) for duplicates.
- [x] I reproduced this on the [latest release](https://github.com/block/berd/releases) (v0.6.2).
- [x] This is one bug, not several bundled together.
### Closest existing issue
none found
Split from the same session as a second, independent bug: TeX `\(...\)` / `\[...\]` and single-dollar `$...$` never become math at all. Filed separately.
### What's broken
When chat math *does* render, the typeset formula is accompanied by extra text. Inline `$$\Omega$$` becomes **ΩΩ**. Display `$$` and fenced `math` show the real equation plus leftover `Ω = n=1Σ∞ n21`.
### Steps to reproduce
1. Launch Berd 0.6.2.
2. New chat. Goose, Grok 4.6 via xAI (`xai_oauth`).
3. Display `$$\Omega$$` on its own line of prose.
4. Display a block:
```text
$$
\Omega = \sum_{n=1}^{\infty} \frac{1}{n^2}
$$
```
5. Display the same equation in a fenced `math` code block.
### What you expected to happen
One typeset formula. No second copy, no doubled glyph.
### What actually happened
From a screenshot of the live bubble:
- Inline `$$\Omega$$` rendered as **ΩΩ** (two omegas, not one).
- Display `$$` showed a correct centered KaTeX formula **and** leftover `Ω = n=1Σ∞ n21`.
- Fenced `math` did the same: correct KaTeX plus the same leftover string.
Observation only, not claimed root cause: the leftover string looks like the TeX with commands stripped, which is how unhidden KaTeX MathML often appears.
### How often does it happen?
Every time — reliably reproducible
### Berd version
0.6.2
### Operating system
macOS (Apple Silicon)
### Model and provider
Grok 4.6 via xAI (Goose / `xai_oauth`)
### Relevant log output
```text
no relevant log output
```
Looked at `~/Library/Logs/xyz.block.berd/berd.log` around the turn. Nothing about KaTeX / math / Streamdown.
### Screenshots, recordings, or other context
Screenshot of this session’s live delimiter matrix (same capture as the companion issue):

Contributor guide
Research direction
No source file or test is named. Launch Berd 0.6.2, open a new chat, and reproduce the inline, display, and fenced math cases described, then trace the chat bubble's KaTeX rendering path. Done means each case shows one typeset formula with no duplicated glyph or leftover plaintext.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100