Skip to content

Conversation

@anand-106
Copy link
Contributor

Fix KaTeX Rendering Issue

Problem

KaTeX rendering is broken for both inline math and math in tables, as reported in #1213. Mathematical expressions are not displaying with proper styling.

Root Cause

The KaTeX JavaScript library is available via the streamdown package, but the KaTeX CSS stylesheet is missing. Without the CSS, math expressions render as unstyled HTML elements.

Solution

Added the KaTeX CSS import to app/globals.css:

@import 'katex/dist/katex.min.css';

Testing

  • ✅ Inline math: $E = mc^2$ now renders properly
  • ✅ Block math: $$\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}$$ displays correctly
  • ✅ Math in tables renders with proper styling
  • ✅ Dark/light mode compatibility maintained

Changes

  • app/globals.css: Added KaTeX CSS import

Fixes #1213

- Add @import 'katex/dist/katex.min.css' to globals.css
- Fixes broken KaTeX rendering for inline math and math in tables
- Resolves issue vercel#1213

The KaTeX JavaScript library was already available via streamdown,
but the CSS stylesheet was missing, causing math expressions to
render without proper styling.
@vercel
Copy link

vercel bot commented Sep 20, 2025

@anand-106 is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Nov 1, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
ai-chatbot Ready Ready Preview Comment Nov 1, 2025 3:52am

@dancer dancer merged commit e4142a9 into vercel:main Nov 1, 2025
3 of 4 checks passed
nwp pushed a commit to nwp/chatbot-sdk that referenced this pull request Nov 1, 2025
Add analysis of 2 recently merged PRs:
- PR vercel#1223: Fix KaTeX rendering issue - adds CSS import for math
- PR vercel#1298: Misc fixes - browser history API fix and weather tool validation

Total PRs now: 18 (was 16 in v2.0)

Key changes in PR vercel#1298:
- Changed replaceState to pushState for proper back button navigation
- Improved weather tool parameter validation with better error handling

PR vercel#1223 fixes math expression rendering for KaTeX-enabled forks.
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.

bug: broken katex rendering inline as well as in table

2 participants