feat(web): add opt-in inline LaTeX rendering setting#1848
Conversation
Single-$ inline math stays off by default: the rule can misdetect prices, env vars, and shell paths ($5, $PATH, $HOME/bin) as math and swallow them into a broken formula. A new Settings switch (desktop dialog and mobile sheet) enables it per browser; messages re-parse on toggle. $$…$$ display math remains always on.
🦋 Changeset detectedLatest commit: 8047059 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8047059512
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| <span class="srow-label">{{ t('settings.inlineMath') }}</span> | ||
| <span class="srow-sub">{{ t('settings.inlineMathHint') }}</span> | ||
| </span> | ||
| <span class="toggle" :class="{ on: inlineMath }" role="switch" :aria-checked="inlineMath" /> |
There was a problem hiding this comment.
Use the shared Switch for the mobile toggle
For mobile users—especially those using assistive technology—this creates a role="switch" span nested inside a button, so focus lands on a button while the checked state belongs to a different nested widget. It also violates the mandatory apps/kimi-web/AGENTS.md rule: “Use the primitives in src/components/ui/” and “do not hand-roll a bespoke … switch.” Render the setting with components/ui/Switch.vue, as the desktop dialog does, so the interactive element itself owns the switch role, label, checked state, and focus styling.
Useful? React with 👍 / 👎.
Related Issue
N/A — small opt-in UX addition requested directly; behavior explained below.
Problem
The web UI only renders
$$…$$display math. Users who write inline$…$LaTeX in prompts/answers see the raw dollar-sign text, but enabling the single-$inline rule unconditionally would misdetect prices, env vars, and shell paths ($5,$PATH,$HOME/bin) as math and swallow them into broken formulas.What changed
$…$spans render as inline KaTeX;$$…$$display math behavior is unchanged either way.configureMathRules); chat markdown re-parses when the toggle flips so the effect is immediate.$5,$PATH,$HOME/bin).Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.