You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You are typing in a template literal. \f in a string in JS means whitespace. Escape you \s.
Otherwise, the CSS maybe doesn’t load? Inspect the DOM. Share what you find.
I switched to rehype mathjax and it worked fine so think the problem is katex related.
Happy to dig into deeper next week. Was a bit under the pump at work this week.
You would have to use double slashes \\ when working with template literals and latex, as the first \ is not recognized as latex syntax. $$ \\frac{-b \\pm \\sqrt{b^2-4ac}}{2a} $$
Initial checklist
Affected packages and versions
react 18.2.21, node 20.6.2, react-markdown 8.0.7, remark-gfm 3.0.1, remark-math 3.0.1, rehype-katex 5.0.0
Link to runnable example
No response
Steps to reproduce
Install packages
npm install react-markdown remark-math rehype-katex katex
.And
import 'katex/dist/katex.min.css';
topage.tsx
.Write component for markdown rendering:
Finally, write
page.tsx
:Expected behavior
Expect math to be rendered without
$$
and$
still visible everywhere.Actual behavior
Math not rendered properly. Instead just read the latex as raw text with
$
etc.Runtime
Node v17
Package manager
npm 8
OS
Linux
Build and bundle tools
Next.js
The text was updated successfully, but these errors were encountered: