fix: prevent KaTeX from treating underscores as subscripts in plain text#6242
fix: prevent KaTeX from treating underscores as subscripts in plain text#6242Abhijay007 merged 1 commit intoblock:mainfrom
Conversation
Signed-off-by: Abhijay007 <Abhijay007j@gmail.com>
|
why does |
The thing is with the default However, within math mode, the underscore character ( |
|
yes, but my concern is that if you run this test: describe('KaTeX Math Rendering - singleDollarTextMath: false', () => { on main, it succeeds, so it is not that if it fails to find a closing $ it executes. |
Um I tried this test on main, it's failing for me for the same reason that it counts it as a subscript |
* 'main' of github.com:block/goose: Claude 3.7 is out. we had some harcoded stuff (#6197) Release 1.19.0 chore: upgrade to node v24 as engine (#6361) chore(deps): bump rsa from 0.9.9 to 0.9.10 (#6358) Bump rust toolchain to 1.92 (current stable) (#6356) Hide advanced recipe options under expandable content (#6021) fix: use .config/agents (plural) for skills directory (#6357) fix: prevent KaTeX from treating underscores as subscripts in plain text (#6242) fix: make goose review PRs more like goose contributors do (#6240) fix : preserve provider engine type when editing custom providers (#6106) feat(providers): add retry for model fetching (#6347) allow goose issue solver to react to activation comments (#6239)
Closes: #6196
PR Summary
This PR fixes an issue with KaTeX math rendering where underscores (
_) were incorrectly treated as subscripts. As a result, text such as$FOO_BARorvariable_namewas rendered in math mode, making code snippets and shell examples unreadable.The root cause was that
remark-mathplugin treats single-dollar expressions ($text$) as inline math by default. When users write shell variables like$FOO_BAR, it unintentionally enters math mode, and KaTeX interprets_as a subscript operator.Changes Made
Configuration Fix
singleDollarTextMath: falsein theremarkMathplugin.$is now treated as plain text, preventing accidental math rendering.$$...$$for display math.Files Modified
ui/desktop/src/components/MarkdownContent.tsx— added configuration and preprocessing logic.Trade-off
Note: Users must now use
$$...$$for math instead of$...$.Why this is acceptable:
remark-mathmaintainers and is adopted by other platforms (e.g., GitLab) facing similar issues.Type of Change
AI Assistance
Testing
Tested in the desktop UI with:
$...$$$...$$Screenshots / Demos (UX)
Before:
After: