feat: render single-dollar and inline double-dollar LaTeX math with KaTeX - #40878
Closed
Cl-VII wants to merge 1 commit into
Closed
feat: render single-dollar and inline double-dollar LaTeX math with KaTeX#40878Cl-VII wants to merge 1 commit into
Cl-VII wants to merge 1 commit into
Conversation
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Based on the search results, here are the potentially related PRs:
The most relevant is PR #40867, which is recent and addresses LaTeX rendering in a complementary way. The other PRs appear to be historical or related attempts at the same problem. |
Author
|
Closing: conflicts with official design decision #34850 (single-dollar math intentionally disabled). Author requested removal. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Related to #40508 (LaTeX rendering in OpenCode). This PR brings ChatGPT-style single-dollar inline math to the web/desktop rendering pipeline, which already renders KaTeX for
\(...\)and block...but not single$...$.Type of change
What does this PR do?
The web/desktop markdown pipeline (
packages/ui/src/context/marked-parser.tsx) registers KaTeX extensions for\(...\)(inline) and...(block, own-paragraph). Model replies commonly use single-dollar inline math (= \beta_0 + \beta_1 x$) and inline...— both currently render as raw LaTeX source.This PR adds two marked inline extensions:
inlineDollarKatex: renders$...$via KaTeXinlineDoubleDollarKatex: renders inline (non-own-paragraph)...via KaTeXEdge cases handled (with tests):
today,.02/GB,$ 5are left untouched(L_{ur}-L_r)\sim\chi^2(Q)$$does not swallow the rest of the text (streaming-safe)\$inside math works...(own-paragraph, display mode) and\(...\)behavior is unchangedHow did you verify your code works?
bun test packages/ui: 35/35)tsgo --noEmittypecheck passes$pairs$...stays as plain text until closed, then renders — no flicker or swallowed textScreenshots / recordings
N/A (HTML output verified; KaTeX renders mathml + html dual output for accessibility)
Checklist