Repository navigation
feat(mobile-web): render math formulas with katex in chat markdown - #3321
Open
BingCHuanJ wants to merge 1 commit into
Open
BingCHuanJ wants to merge 1 commit into
BingCHuanJ wants to merge 1 commit into
Conversation
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.
Summary
Adds KaTeX math rendering support (
remark-mathandrehype-katex) to chat markdown messages inmobile-web. It supports inline ($...$,\(...\)) and block ($$...$$,\[...\]) LaTeX formulas with mobile-responsive horizontal scrolling.Type and Areas
Type: Feature
Areas: mobile web
Motivation / Impact
Currently, LaTeX math formulas sent in remote control chats are displayed as raw text (e.g.
$\alpha$or$$\sum_{i=1}^n x_i$$), making technical discussions and math responses hard to read on mobile devices.This PR adds:
katex,remark-math, andrehype-katex.\(...\)->$...$,\[...\]->$$...$$) with code block protection (safe replacement avoiding string substitution patterns like$$)..katex-displaywith horizontal scrolling and max-width bounds to prevent layout overflow on narrow mobile screens.Verification
pnpm --dir src/mobile-web run type-check: passed cleanly with zero type errors.pnpm --dir src/mobile-web run test:ui-components: passed (17/17 tests passing, including delimiter normalization, code block isolation, and math plugin styling tests).node --test tests/host-dialog-queue-browser.test.mjs: passed browser verification for KaTeX formula DOM generation.node --test scripts/audit-theme-colors.test.mjs: passed (32/32 tests passing).pnpm run check:repo-hygiene: passed all product identity, version synchronization, and repository hygiene audits.Reviewer Notes
katex/dist/katex.min.cssbundled with font handling compatible with mobile assets..katex-display) are constrained to viewport bounds with-webkit-overflow-scrolling: touchfor smooth touch scrolling.Checklist