[Bug] ZCode markdown renderer: Single-$ math mode corrupts text with dollar signs
Nobody has claimed this yet.
- Dominant language
- No language data
- Stars
- 22
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
Bug Description
ZCode chat markdown renderer incorrectly interprets $ characters as math delimiters, converting normal text (currency, variables, prices) into KaTeX math expressions.
Problem Behavior
What Happens:
- User types text containing
$(currency, variable names, etc.) - ZCode uses single-dollar inline math (
micromark-extension-math+KaTeX) - Every pair of
$opens/closes a math span - Text between
$becomes: italic serif, collapsed spacing, eaten line breaks
Example:
Input: "Cost is $50 for one and $100 for two"
Output: "50 for one and" renders as MATH expression!
Technical Root Cause
- File:
resources\app.asar → out\renderer\assets\styles-BvByAfPm.js - Config:
math: gT({singleDollarTextMath:!0})— hardcoded to TRUE - Problem: No settings toggle exists to disable this
- Search: This string appears exactly ONCE in entire app as config
Impact Severity
Reporter tested against actual session transcript:
"Nearly every paragraph and table row had multiple math spans, some swallowing 30–60 words of prose"
| Metric | Finding |
|---|---|
| Paragraphs affected | Nearly every one |
| Table rows affected | Nearly every row |
| Max words swallowed | 30-60 words per span |
Affected Content Types:
- Currency: "$50", "$100", "$29.99"
- Variables: "$var", "$user.name",
${expr} - Prices in tables
- Shell code / terminal output
- Any text with $ character
Why Critical for ZCode Users
- Developers use $ constantly — PHP, shell vars, JS template literals
- Code discussions break — Variable names become math
- Technical writing corrupted — Pricing, budgets, configs
- Unpredictable — Cannot easily predict what triggers math mode
- No workaround — No setting to disable it
Suggested Fixes
Option A: Disable Single-Dollar Math (Recommended)
// Change hardcoded config:
math: gT({singleDollarTextMath: false}) // Require $$ instead
Option B: Add Settings Toggle
Settings → Editor → Markdown Rendering
☐ Enable single-dollar inline math ($...$)
☑ Use double-dollar only ($$...$$) [safer]
Option C: Smarter Heuristic
Only treat as math if content looks like math (no spaces, short, math-like chars only).
Option D: Escape Mechanism
Allow \$50 to render as literal $50.
Reproduction Steps
- Open ZCode
- Send message: "The price is $50 or $100"
- Observe: Text between $ signs becomes italic math
- Try table:
| Cost | $50 |→ Formatting breaks
Reporter Info
- Source: Discord
- Reporter: Luke (OP)
- Timestamp: Yesterday at 4:38 AM
- Technical Level: Advanced (analyzed app.asar source)
Severity: P1 High
- Silent data corruption of output text
- Affects nearly all text with $ characters
- No user workaround available
- Particularly bad for developers (primary users)
Labels Suggested:
bug, markdown, renderer, math, katex, zcode, text-corruption
Submitted by:
Regards,
Roman (Discord: bignavi_x)
- Z.ai Volunteer Ambassador
- Tech resources channel: https://t.me/VibeCodePrompterSystem
- Tech Blog: http://claw.rommark.dev/blog
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the renderer configuration in resources\app.asar → out\renderer\assets\styles-BvByAfPm.js and confirm the single occurrence of math: gT({singleDollarTextMath:!0}). Reproduce the issue with “The price is $50 or $100” and a table containing $50; done means literal dollar-sign text renders normally while the selected math-delimiter behavior is verified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100