[PR #11033] fix(ui): allow KaTeX inline math to be followed by punctuation #13634

Closed
opened 2026-02-16 18:18:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/11033

State: closed
Merged: Yes


Summary

Fixes #10979

Enable nonStandard: true in marked-katex-extension to allow inline math expressions to be immediately followed by punctuation like ), ], }, ;, etc.

Problem

When inline math delimited with $...$ is immediately followed by punctuation (e.g., $\alpha$)), the math fails to render. This is because the standard regex in marked-katex-extension only allows whitespace and limited punctuation after the closing $.

Solution

The marked-katex-extension package already provides a nonStandard option that removes this restriction, allowing any character to follow the closing delimiter. This is the minimal change to fix the issue.

Changes

  • packages/ui/src/context/marked.tsx (+1 line): Add nonStandard: true to markedKatex config

Test Plan

  • In the web UI, enter $\alpha$) in a chat message
  • Expected: The Greek letter alpha followed by a closing parenthesis
  • Previously: KaTeX parsing error / math not rendered

🤖 Generated with Claude Code (issue-hunter-pro)

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/11033 **State:** closed **Merged:** Yes --- ## Summary Fixes #10979 Enable `nonStandard: true` in marked-katex-extension to allow inline math expressions to be immediately followed by punctuation like `)`, `]`, `}`, `;`, etc. ## Problem When inline math delimited with `$...$` is immediately followed by punctuation (e.g., `$\alpha$)`), the math fails to render. This is because the standard regex in marked-katex-extension only allows whitespace and limited punctuation after the closing `$`. ## Solution The `marked-katex-extension` package already provides a `nonStandard` option that removes this restriction, allowing any character to follow the closing delimiter. This is the minimal change to fix the issue. ## Changes - `packages/ui/src/context/marked.tsx` (+1 line): Add `nonStandard: true` to markedKatex config ## Test Plan - In the web UI, enter `$\alpha$)` in a chat message - Expected: The Greek letter alpha followed by a closing parenthesis - Previously: KaTeX parsing error / math not rendered --- 🤖 Generated with Claude Code (issue-hunter-pro)
yindo added the pull-request label 2026-02-16 18:18:28 -05:00
yindo closed this issue 2026-02-16 18:18:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#13634