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
Chat shows LaTeX math as raw text ($...$ / $$...$$ not rendered) #45
Varro renders Markdown in chat, but LaTeX math is left as plain text. Inline math keeps the $ delimiters and backslash commands, and display math ($$...$$) is shown literally as a normal paragraph. Math-heavy answers (papers, statistics, ML) become hard to read.
Environment
Varro: 0.33.15
VS Code: 1.121.0
OpenCode: v2.0.32
OS: Linux 6.8.0-138-generic (x64)
Steps to reproduce
Open a chat session in Varro.
Ask the model to answer with LaTeX, for example: "Write the Gaussian density and a Kalman-style update in LaTeX, using $...$ for inline math and $$...$$ for display math."
Look at the rendered reply. The TeX source is shown verbatim.
The message shows the source text instead of formulas:
$\mathcal{N}(\mu_t^{(p)},\Sigma_t^{(p)})$ appears with visible dollar signs;
$$\hat\mu_t...$$ appears as a normal paragraph, including \hat, \mu, \Sigma, \qquad, and \top;
long display equations wrap mid-expression, which makes them hard to parse.
Expected
$...$ renders as inline math.
$$...$$ renders as a centered display block.
Math inside code spans and fenced code blocks stays literal.
Plain currency such as $5 is not interpreted as math.
Rendering works offline, follows the current light/dark theme, and respects the existing HTML sanitization/CSP rules.
Additional context
I had a quick look at the source: src/webview/components/MarkdownRenderer.tsx configures marked with GFM and custom renderers, but there is no math extension, and neither KaTeX nor MathJax is a chat dependency (katex only appears as a mermaid override in package.json). So this looks like missing support rather than a regression. A typical fix would be marked-katex-extension with bundled KaTeX CSS/fonts, keeping the generated HTML inside the current sanitizer and CSP rules. I am happy to test a build if that helps.
Thank you @xiuguangli for the feature request and contributing the PR (#46)!
LaTeX support is a great addition for math-heavy conversations, and I’ve implemented it based on your contribution.
I integrated the feature manually because review uncovered two parsing cases that needed fixes:
Display equations immediately following prose stayed literal unless separated by a blank line.
Blank lines inside equations caused the streaming renderer to split the formula.
Streaming and performance optimizations.
Both are now covered by regression tests. I also used KaTeX 0.19.0 with direct Marked integration, since marked-katex-extension currently requires KaTeX below 0.19.
Inline and display math now render with bundled offline fonts, and wide equations scroll within the chat column. Thanks for the clear examples and for getting this feature started!
Adding a space after : makes the inline formulas render. The opening boundary currently accepts whitespace, (, [, {, but not :, ,, 。, ;, !, ?, 、, or CJK text; the closing side already accepts CJK punctuation.
Thanks @koltyakov, confirmed on 0.33.19. The inline formulas from the report now render correctly next to Chinese punctuation and CJK text, and display math still works.
Appreciate the quick fix and the added regression coverage for CJK boundaries and streaming. This resolves the issue for me.
Activity
koltyakov commentedon Oct 22, 2026
Thank you @xiuguangli for the feature request and contributing the PR (#46)!
LaTeX support is a great addition for math-heavy conversations, and I’ve implemented it based on your contribution.
I integrated the feature manually because review uncovered two parsing cases that needed fixes:
Both are now covered by regression tests. I also used KaTeX 0.19.0 with direct Marked integration, since
marked-katex-extensioncurrently requires KaTeX below 0.19.Inline and display math now render with bundled offline fonts, and wide equations scroll within the chat column. Thanks for the clear examples and for getting this feature started!
The feature will be published in v0.33.17
feat: render inline and streamed LaTeX offline in chat, #45, #46
koltyakov commentedon Oct 22, 2026
@xiuguangli the update is published, please check how it works for you.
xiuguangli commentedon Oct 23, 2026
Thanks @koltyakov for the quick update and for carrying this forward. I appreciate the streaming fixes and the direct KaTeX 0.19 integration.
I checked 0.33.17. Display math works, but inline math still renders as literal text when it follows Chinese text or punctuation without a space:
To reproduce, ask the agent to output:
Adding a space after
:makes the inline formulas render. The opening boundary currently accepts whitespace,(,[,{, but not:,,,。,;,!,?,、, or CJK text; the closing side already accepts CJK punctuation.Thanks again for the fast turnaround.
fix: render inline math next to CJK text and punctuation, #45
koltyakov commentedon Oct 23, 2026
Interesting edge case...
Before:
After:
Should be good now.
Published the update, v0.33.19.
Happy mathing!
xiuguangli commentedon Oct 23, 2026
Thanks @koltyakov, confirmed on 0.33.19. The inline formulas from the report now render correctly next to Chinese punctuation and CJK text, and display math still works.
Appreciate the quick fix and the added regression coverage for CJK boundaries and streaming. This resolves the issue for me.
koltyakov commentedon Oct 23, 2026
Nice! Thanks for confirming!