You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Desktop app does not render inline LaTeX math ($...$) #39170
When using the opencode Desktop app (Windows), block-level LaTeX math enclosed in $$...$$ renders correctly, but inline math enclosed in $...$ is displayed as raw LaTeX source code instead of being rendered.
Steps to reproduce:
Ask the AI agent to output inline math, e.g., $E = mc^2$
Observe that it appears as literal $E = mc^2$ text
Compare with block math $$...$$, which renders properly
Expected behavior:
Inline math $...$ should be rendered the same way as block math $$...$$.
Environment:
opencode Desktop (latest version)
Occurs on all platforms
The issue is likely in the Markdown renderer — it only applies math rendering to fenced $$ blocks but does not handle inline $ delimiters. This is a common oversight in Markdown math implementations; libraries like KaTeX or MathJax handle both out of the box.
Plugins
No response
OpenCode version
Latest
Steps to reproduce
No response
Screenshot and/or share link
Operating System
Windows11
Terminal
No response
Reacted by Kaustubh Kadam, supplient, Mohamed Hafdi Idrissi and William E. H. Qvaale
Please search existing issues before submitting to help us keep the tracker tidy. If your issue is distinct (e.g., specifically about inline $...$ vs block $$...$$ rendering asymmetry rather than math not rendering at all), please note what makes it different from the issues above.
Ask the model to include inline LaTeX in normal prose, for example:
$v_\pi(s) = \mathbb{E}_\pi[G_t \mid S_t=s]$
$R_{t+1} + \gamma V(S_{t+1})$
The expressions are shown as literal LaTeX source instead of rendered math.
Markdown headings, lists, and other formatting render normally; the problem is specifically noticeable for math delimiters in assistant messages.
Expected behavior
Inline $...$ expressions should render as math in the Desktop UI (for example via KaTeX), with consistent support for standard block math as well.
This is particularly disruptive in math-heavy tutoring and technical explanations because subscripts, Greek symbols, expectations, and longer equations become difficult to read.
$ cat ~/.config/opencode/AGENTS.md
# Global Engineering Guidelines
# MATH & SYMBOL FORMATTING:
- DO NOT use LaTeX formatting (e.g., $ ... $ or $$ ... $$) for math, symbols, or equations.
You must use standard plain text and native Unicode characters (e.g.,
use ≈ instead of \approx, or x^2 instead of $x^2$).
This fails for me - despite instructions in agent.
Related reproduction on the Desktop GUI: display math delimited with \[...\] is also rendered as raw LaTeX instead of KaTeX. This happens frequently with OpenAI models, which often emit \[...\] for standalone equations.
Expected: the expression should render as display math in the Desktop UI.
Actual: the complete \[...\] source is shown as plain text, while some inline expressions using \(...\) render correctly.
The current GUI parser in packages/ui/src/context/marked-parser.tsx already uses KaTeX. Its inline tokenizer recognizes \(...\), and its block tokenizer recognizes $$ blocks only when the opening and closing delimiters are on separate lines. It does not include a tokenizer for \[...\].
The GUI path uses this parser through packages/session-ui/src/components/markdown.worker.ts, so this looks like a small Markdown tokenizer coverage gap rather than a missing rendering dependency. Supporting \[...\] as display-math delimiters would make the existing KaTeX integration handle the format produced by these models.
Same symptom on the latest Desktop build — adding a v2.0.14 case with byte-level evidence that the message content is not the cause.
Environment
OpenCode Desktop: 2.0.14 (bundled CLI 2.0.14)
OS: Windows 11 (Windows_NT 10.0.26200, win32 x64)
Install/channel: release
Symptom
Assistant replies render Markdown normally (headings, bold, tables, lists, code blocks), but all math falls back to raw LaTeX source. No error is surfaced; the $...$ / $$...$$ delimiters are shown literally.
Evidence that the message content is fine
Reading the raw message back from the local session store (GET /api/session/{sessionID}/message):
The text is standard Markdown + LaTeX.
No \ escaping and no ``` fence wrapping.
$ delimiters are balanced (even count).
So this is not a producer-side escaping or fencing problem.
Evidence that the formulas are fine
Every formula from the failing reply was rendered through KaTeX 0.16.11 with throwOnError: true (the same strictness the Desktop renderer uses):
All render without error, including \operatorname and CJK inside \text{}. The failure is therefore in the Desktop chat renderer's math recognition, not in KaTeX parsing.
Notes
app.asar bundles KaTeX (fonts + renderToString) and streamdown, so the capability is present in this build; it is simply not applied to the math in messages.
Activity
github-actions commentedon Jul 27, 2026
This issue might be a duplicate of existing issues. Please check:
Please search existing issues before submitting to help us keep the tracker tidy. If your issue is distinct (e.g., specifically about inline
$...$vs block$$...$$rendering asymmetry rather than math not rendering at all), please note what makes it different from the issues above.bisuwuss-netizen commentedon Aug 3, 2026
Confirmed on macOS as well.
Environment
ai.opencode.desktopReproduction
$v_\pi(s) = \mathbb{E}_\pi[G_t \mid S_t=s]$$R_{t+1} + \gamma V(S_{t+1})$Markdown headings, lists, and other formatting render normally; the problem is specifically noticeable for math delimiters in assistant messages.
Expected behavior
Inline
$...$expressions should render as math in the Desktop UI (for example via KaTeX), with consistent support for standard block math as well.This is particularly disruptive in math-heavy tutoring and technical explanations because subscripts, Greek symbols, expectations, and longer equations become difficult to read.
pradnX commentedon Aug 30, 2026
~/.config/opencode/AGENTS.mdThis fails for me - despite instructions in agent.
beihaixingchen commentedon Sep 9, 2026
Related reproduction on the Desktop GUI: display math delimited with
\[...\]is also rendered as raw LaTeX instead of KaTeX. This happens frequently with OpenAI models, which often emit\[...\]for standalone equations.Example assistant output:
Expected: the expression should render as display math in the Desktop UI.
Actual: the complete
\[...\]source is shown as plain text, while some inline expressions using\(...\)render correctly.The current GUI parser in
packages/ui/src/context/marked-parser.tsxalready uses KaTeX. Its inline tokenizer recognizes\(...\), and its block tokenizer recognizes$$blocks only when the opening and closing delimiters are on separate lines. It does not include a tokenizer for\[...\].The GUI path uses this parser through
packages/session-ui/src/components/markdown.worker.ts, so this looks like a small Markdown tokenizer coverage gap rather than a missing rendering dependency. Supporting\[...\]as display-math delimiters would make the existing KaTeX integration handle the format produced by these models.Focus786 commentedon Sep 24, 2026
Same symptom on the latest Desktop build — adding a v2.0.14 case with byte-level evidence that the message content is not the cause.
Environment
Windows_NT 10.0.26200, win32 x64)Symptom
Assistant replies render Markdown normally (headings, bold, tables, lists, code blocks), but all math falls back to raw LaTeX source. No error is surfaced; the
$...$/$$...$$delimiters are shown literally.Evidence that the message content is fine
Reading the raw message back from the local session store (
GET /api/session/{sessionID}/message):\escaping and no ``` fence wrapping.$delimiters are balanced (even count).So this is not a producer-side escaping or fencing problem.
Evidence that the formulas are fine
Every formula from the failing reply was rendered through KaTeX 0.16.11 with
throwOnError: true(the same strictness the Desktop renderer uses):A^{-1}AB=BA=I,\qquad B=A^{-1}\det(A)\neq0\iff\operatorname{rank}(A)=n\iff A\ \text{可逆}\iff Ax=0\ \text{只有零解}\iff \text{行(列)向量组线性无关}A^{-1}=\dfrac{1}{ad-bc}\begin{pmatrix}d&-b\\-c&a\end{pmatrix}(A\mid I)\to(I\mid A^{-1})\text{可逆}All render without error, including
\operatornameand CJK inside\text{}. The failure is therefore in the Desktop chat renderer's math recognition, not in KaTeX parsing.Notes
app.asarbundles KaTeX (fonts +renderToString) and streamdown, so the capability is present in this build; it is simply not applied to the math in messages.\[...\]report above look like the same root cause.Workaround
Pasting the same message into Obsidian renders
$...$correctly, confirming the source bytes are correct.neriousy commentedon Oct 1, 2026
Closing as a duplicate of #38030. Same Desktop LaTeX rendering regression (comments show block math is affected too). Tracking in #38030.