-
-
Notifications
You must be signed in to change notification settings - Fork 874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Katex rehype plugin does not render markdown math #777
Comments
You are typing in a template literal. |
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.
|
What is “fine”. It shouldn’t work fine either, with your code it should instead crash. Or you have different code, and likely don’t have CSS? |
You would have to use double slashes \\ when working with template literals and latex, as the first \ is not recognized as latex syntax. |
At present, GPT4 will not return the mathematical formula beginning and ending with '$$', and katex cannot work normally at this time. What should I do? |
make a repro |
This comment has been minimized.
This comment has been minimized.
Like the markdown text described below (returned by gpt4o), the mathematical formula is not surrounded by $$, which causes the mathematical formula to not render correctly markdown: Overview of Lorentz Transformation
Where (\gamma) is the Lorentz factor, defined as: My react-markdown reference code looks like this
|
That seems very different from what the person reported here?
You have markdown that uses one style of math.
No clue. This project doesn’t do, or attempt to do, what you want. |
Closing this. OP was unclear what problem they had (like about how escapes work in JavaScript?), so I left it open for them to clarify. |
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: