block / block/berd

Chat markdown does not render TeX \(...\) / \[...\] or single-dollar math

Open
#239 1 comment 0 reactions 0 assignees View on GitHub
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 display bug: when `$$` / fenced `math` *do* parse, a garbled plaintext copy still appears. Filed separately.

### What's broken

Chat markdown does not render TeX-style `\(...\)` / `\[...\]` or single-dollar `$...$` as math. Those stay literal (and `\(` / `\[` lose the backslash). Double-dollar and fenced `math` do parse; that path has a separate display bug.

### Steps to reproduce

1. Launch Berd 0.6.2.
2. New chat. Goose, Grok 4.6 via xAI (`xai_oauth`). No prior history needed; this is renderer behavior.
3. Have the assistant emit (or otherwise display) these in one message:
- inline TeX: `\( \Omega \)`
- display TeX:

```text
\[
\Omega = \sum_{n=1}^{\infty} \frac{1}{n^2}
\]
```

- spaced single-dollar: `$ \Omega $`
- tight single-dollar: `$\Omega$`
4. Compare to `$$\Omega$$`, a `$$` display block, and a fenced `math` block in the same message.

### What you expected to happen

`\(...\)`, `\[...\]`, and `$...$` render as math, the way common model output is written (Anthropic/TeX vs OpenAI-style delimiters).

### What actually happened

From a screenshot of the live bubble:

1. `\( \Omega \)` rendered as `( Ω )` — backslash eaten, not math.
2. `\[ ... \]` rendered as `[ Ω = \sum_{n=1}^{\infty} \frac{1}{n^2} ]` — same, not math.
3. `$ \Omega $` stayed literal `$ Ω $`.
4. `$\Omega$` stayed literal `$\Omega$`.
5. `$$\Omega$$`, a `$$` display block, and fenced `math` *did* become KaTeX (those still show a garbled duplicate; separate issue).

### 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`). Renderer-side; any model that emits these delimiters should hit it.

### 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):

![Chat bubble showing TeX and single-dollar math staying literal, while $$ and fenced math parse](https://gist.githubusercontent.com/exAClior/f428e7d588c5e50f17f1358fe8937863/raw/berd-0.6.2-chat-math.png)

Contributor guide

Open the contributing guide

Research direction

Start at the chat markdown renderer and its existing KaTeX/Streamdown handling, comparing the working $$ and fenced math paths with the unsupported \(...\), \[...\], and single-dollar delimiters. Reproduce the delimiter matrix from the issue and verify that all listed TeX forms render as math without changing the already separate duplicate-display behavior.

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
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.