-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix: more strict latex math rendering #5286
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Greptile Summary
This PR implements stricter LaTeX math rendering by disabling single dollar sign text math parsing across three key markdown rendering components in the chat system. The change modifies the remarkMath
plugin configuration by setting singleDollarTextMath: false
in:
web/src/app/chat/message/messageComponents/markdownUtils.tsx
(line 103)web/src/components/chat/MinimalMarkdown.tsx
(lines 49-52)web/src/app/chat/message/thinkingBox/ThinkingBox.tsx
(lines 297-300)
This configuration change prevents single dollar signs ($expression$
) from being interpreted as LaTeX math delimiters, requiring double dollar signs ($$expression$$
) or other explicit math notation instead. The modification addresses a common issue where dollar signs in regular text contexts—such as currency amounts ($100
), shell variables ($PATH
), or code discussions—were being incorrectly rendered as LaTeX math expressions.
The change aligns with the existing preprocessLaTeX
function in codeUtils.ts
which already handles dollar sign protection in code contexts, creating a more cohesive and predictable LaTeX rendering system throughout the application. By applying this configuration consistently across all three markdown components, the system ensures uniform math rendering behavior in chat messages, minimal markdown displays, and AI thinking boxes.
PR Description Notes:
- The description and testing sections are placeholder templates and should be filled out with specific details about the changes and verification methods used.
Confidence score: 4/5
- This PR is safe to merge with minimal risk as it's a conservative change that reduces unwanted LaTeX rendering
- Score reflects the straightforward nature of the configuration change and consistent application across components, though testing details are missing from the PR description
- Pay close attention to user-facing impact testing to ensure legitimate math expressions still render correctly with double dollar signs
3 files reviewed, no comments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 issue found across 3 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai
to give feedback, ask questions, or re-run the review.
Description
Grant street issue: https://onyx-company.slack.com/archives/C05UR9DG5Q8/p1756315878608459
Wrap all code identifiers, variable names, and snippets in backticks. => might also be good for our system prompt in certain situations.
How Has This Been Tested?
[Describe the tests you ran to verify your changes]
Backporting (check the box to trigger backport action)
Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.