Skip to content

Fixes #35450: render block-editor math with katex directly, drop react-latex-next - #35451

Queued
harsh-vador wants to merge 3 commits into
mainfrom
fix/katex-direct-render
Queued

harsh-vador wants to merge 3 commits into
mainfrom
fix/katex-direct-render

Conversation

@harsh-vador

@harsh-vador harsh-vador commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #35450

react-latex-next@3.0.0, its latest release, ships its own copy of katex 0.16.10 in dist/index.js. That copy is what renders block-editor equations. The katex package only supplied the stylesheet. Bumping katex, as Dependabot tried in #34736, would have moved the CSS to a new version and left the renderer on 0.16.10. So the katex advisory fixed in 0.18.2 couldn't be cleared with katex or resolutions.

This PR:

  • renders math through katex's own katex/contrib/auto-render instead of react-latex-next. It uses the same delimiters ($$…$$, $…$, \(…\), \[…\]), so stored equations render as before. Text outside the delimiters stays as text, and malformed math falls back to its source text, as before.
  • removes react-latex-next. main has since moved katex to ^0.19.0 (build(deps): bump the npm-minor-patch group across 1 directory with 44 updates #35282) but still shipped react-latex-next, so its renderer stayed on the bundled 0.16.10. With it gone, the stylesheet and the renderer both come from katex 0.19.0.

KaTeX 0.17–0.19 list three breaking changes, and none affects us. The internal __defineFunction API changed (we don't use it). Internal CSS classes were renamed (nothing in the UI overrides them). And strict warnings now cover missing character metrics (we don't configure strict).

Type of change:

  • Bug fix

High-level design:

N/A, small change: one component, its test, one Playwright assertion, and dependencies.

playwright-report-overview

Tests:

Use cases covered

  • $$…$$ and $…$ equations render with KaTeX in the block editor and in the saved description, including after a reload.
  • Text next to an equation is shown as text.
  • Malformed math shows its source text and nothing throws.

Unit tests

  • MathEquationComponent.test.tsx: the react-latex-next mock is gone, so the tests now run real KaTeX. Added: delimited math renders .katex, text outside the delimiters is rendered as text, and malformed math stays as its source text.

Playwright (UI) tests

  • BlockEditorMathEquations.spec.ts now also checks that KaTeX output (.katex) is shown after the save and reload, not just the node wrapper.
  • make playwright_affected selects 26 specs, because package.json, yarn.lock and the component files are not in the impact map. Locally I ran the changed spec plus the 4 specs mapped to these files (they all render descriptions in the block editor). The remaining smoke and canary specs change global settings (access control, search RBAC, intake forms) or need Explore search, which this local backend can't provide; the merge queue runs the full suite.

Branch merged with main at dcd6cd58d96 (katex 0.19.0), served by Vite against a local server with CI's sample data loaded, in the classic shell, PLAYWRIGHT_IS_OSS=true, --retries=0 --workers=4, HTML reporter. The setup, entity-data-setup and entity-data-teardown steps ran as dependencies, as in CI.

Spec Passed Failed
Features/BlockEditorMathEquations.spec.ts 1 0
Features/Table.spec.ts 16 0
Features/Topic.spec.ts 4 0
Pages/CustomPropertiesApiContract.spec.ts 18 0
Pages/CustomProperties.spec.ts 159 0
setup / teardown steps 3 0
Total 201 0

Report screenshot:

Manual testing performed

  1. Ran this branch's UI (Vite) against a local server and saved a table description holding a $$x^2 + y^2 = z^2$$ math block plus text after it. The equation renders with KaTeX and the text appears as plain text.
  2. Ran the same check with main's component for comparison: the equation renders, and the text after it is parsed as HTML.
  3. Ran tsc (no errors in the changed files), ESLint, Prettier, and yarn ui-checkstyle:changed / ui-checkstyle:playwright:changed. All clean.

UI screen recording:

Not applicable. This is a dependency and rendering fix with no new UI; the Playwright spec covers the rendered output.

Checklist:

  • I have read the CONTRIBUTING document.
  • My PR title is Fixes <issue-number>: <short explanation>
  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.
  • I have commented on my code, particularly in hard-to-understand areas.
  • I have added tests (unit / integration / Playwright as applicable) and listed them above.
  • I have added a test that covers the exact scenario we are fixing.

🤖 Generated with Claude Code

…ex-next

react-latex-next 3.0.0 (its latest release) bundles its own copy of
katex 0.16.10, so bumping the katex package never changed the code that
renders equations: only the stylesheet moved, leaving it out of step with
the renderer.

Render through katex's own auto-render instead, with the same delimiters
react-latex-next used, and move katex to ^0.18.2. auto-render keeps the
text outside the delimiters as text nodes, and malformed math still falls
back to its source text.
@harsh-vador harsh-vador added the UI UI specific issues label Oct 14, 2026
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

@github-actions

Copy link
Copy Markdown
Contributor

Hi there 👋 Thanks for your contribution!

The OpenMetadata team will review the PR shortly! Once it has been labeled as safe to test, the CI workflows
will start executing and we'll be able to make sure everything is working as expected.

Let us know if you need any help!

@harsh-vador harsh-vador self-assigned this Oct 14, 2026
@harsh-vador harsh-vador added the safe to test Add this label to run secure Github workflows on PRs label Oct 14, 2026
@github-actions

github-actions Bot commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 77%
77.68% (125758/161889) 64.31% (79427/123494) 65.52% (26510/40456)

main has since bumped katex to ^0.19.0 (#35282) but still ships
react-latex-next, so its renderer stays on the bundled katex 0.16.10.
Keep main's katex ^0.19.0 and drop only react-latex-next; the lockfile
change is just its three blocks.
Sonar S7780: write the \( \) \[ \] delimiters with String.raw instead of
escaped backslashes. The values are unchanged.
@gitar-bot

gitar-bot Bot commented Oct 15, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Replacing react-latex-next with KaTeX auto-render changes equation parsing and error handling; delimiter differences could render stored descriptions incorrectly.

Renders block-editor math with KaTeX's own auto-render in place of react-latex-next, using the same delimiters so stored equations display as before. Removes react-latex-next and moves katex to ^0.18.2 so the stylesheet and renderer share one version. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@harsh-vador
harsh-vador enabled auto-merge October 15, 2026 11:00
@sonarqubecloud

Copy link
Copy Markdown

@harsh-vador
harsh-vador added this pull request to the merge queue Oct 15, 2026
Any commits made after this event will not be merged.
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-10-15T19:19:52Z)

Blocked the queue: playwright-summary

Failed Playwright tests:

  • Features/BulkEditEntity.spec.ts › Database Schema

@anuj-kumary
anuj-kumary added this pull request to the merge queue Oct 15, 2026
Any commits made after this event will not be merged.

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

safe to test Add this label to run secure Github workflows on PRs UI UI specific issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block editor math: bumping katex does not change the renderer (react-latex-next bundles katex 0.16.10)

3 participants