Skip to content

feat(web): add opt-in double-dollar math rendering - #16469

Draft
justelson wants to merge 1 commit into
pingdotgg:mainfrom
justelson:fix/markdown-math
Draft

justelson wants to merge 1 commit into
pingdotgg:mainfrom
justelson:fix/markdown-math

Conversation

@justelson

Copy link
Copy Markdown

Chat and Markdown previews display double-dollar LaTeX as raw text, including multiline aligned equations. A device-local, disabled-by-default Render LaTeX math preference enables the standard remark-math parser and lazy KaTeX rendering in the shared web/desktop renderer.

  • Supports inline $$x^2$$ and multiline $$ display equations.
  • Preserves code, single-dollar text, sanitization, and LaTeX when copying selections.
  • Wide equations scroll; invalid expressions retain readable source.

Enable Settings → General → Render LaTeX math, then display:

$$
P(\text{lunch}) = \frac{\text{cheese}^{2}}{1 + \text{meetings}}
$$

Focused verification on Windows:

Check Result
ChatMarkdown.test.tsx 54 passed
markdown-clipboard.test.ts 25 passed
settings.test.ts 160 passed
useSettings.test.ts 19 passed
vp run --filter @t3tools/web typecheck Passed
Targeted vp lint Passed; 11 warnings reproduced in unchanged baseline files

Tests cover opt-in/opt-out, settings persistence, raw-HTML modes, aligned expressions, incomplete/invalid streaming output, ordinary code and currency, and source copying. Commands used vp test run <listed files> --maxWorkers 1; no repo-wide checks were run.

This deliberately supports only double-dollar syntax using one standard parser, with singleDollarTextMath: false; it adds no custom delimiter parser. Native mobile, single-dollar math, and backslash delimiters are outside this proposal.

Maintainer scope approval is pending. The earlier opt-in response conditions acceptance on complexity; this draft does not claim approval of this implementation. Related proposals: #12118 and #14574.

Before/after browser evidence is pending: preview_open reported that this environment has no automation host. The repository's test-t3-app skill prohibits switching automation systems; a user override for isolated Playwright has been requested. The running installed app and its database were not modified. Browser layout, partial DOM selection copying, and production bundle splitting have not yet been verified.

Model: gpt-6.1-sol. Harness: Codex in T3 Code.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L 100-499 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant