Skip to content

fix: enable inline math formula rendering in web UI#1474

Open
Br1an67 wants to merge 1 commit intoMoonshotAI:mainfrom
Br1an67:fix/web-inline-math-rendering
Open

fix: enable inline math formula rendering in web UI#1474
Br1an67 wants to merge 1 commit intoMoonshotAI:mainfrom
Br1an67:fix/web-inline-math-rendering

Conversation

@Br1an67
Copy link

@Br1an67 Br1an67 commented Mar 17, 2026

Problem

Block math ($$...$$) renders correctly, but inline math ($...$) does not because all rehype plugins are disabled in the streamdown configuration.

Fix

Re-enable the 'katex' rehype plugin specifically. KaTeX only processes math delimiters and does not pose an XSS risk (unlike the 'raw' and 'harden' plugins which remain disabled).

Also import katex/dist/katex.min.css for proper formula styling. The katex package is already a transitive dependency of streamdown (confirmed in package-lock.json).

Fixes #1420


Open with Devin

devin-ai-integration[bot]

This comment was marked as resolved.

@Br1an67 Br1an67 force-pushed the fix/web-inline-math-rendering branch from 6c57004 to 5d4f199 Compare March 17, 2026 07:19
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d4f1991dc

ℹ️ 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".

import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import "./index.css";
import "katex/dist/katex.min.css";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Declare katex as a direct web dependency

Importing katex/dist/katex.min.css here relies on katex being hoisted from streamdown’s transitive dependencies, but web/package.json does not declare katex itself. This can break the web build in environments that don't hoist transitive packages (or after future dependency graph changes), where Vite will fail to resolve the import at startup; adding katex as a direct dependency avoids that fragility.

Useful? React with 👍 / 👎.

@Br1an67 Br1an67 force-pushed the fix/web-inline-math-rendering branch from 5d4f199 to 5fe090c Compare March 17, 2026 07:32
Block math formulas (using $$...$$) rendered correctly, but
inline math (using $...$) was not rendered because the katex
rehype plugin was disabled along with all other plugins.

Re-enable the katex rehype plugin specifically, as it only
processes math delimiters and does not pose an XSS risk (unlike
the 'raw' and 'harden' plugins which remain disabled).

Import katex CSS for proper formula styling.

Fixes MoonshotAI#1420
@Br1an67 Br1an67 force-pushed the fix/web-inline-math-rendering branch from 5fe090c to 0c15ebe Compare March 17, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

web未能渲染行内公式 || web failed to render the inline formula

1 participant