Katex and Mathjax in Nextjs #54852
Unanswered
edward1127
asked this question in
Help
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Summary
Given https://codesandbox.io/s/katex-mhchem-wl7q64 and https://stackblitz.com/edit/nextjs-xvqkxb?file=pages/index.js clearly
rehype-katex
clearly can access the mhchem context.https://stackblitz.com/edit/stackblitz-starters-ueq3rk?file=src%2FApp.tsx Shows that everything works fine in React.
With the smaller reproducible examples it's increasingly looking like it works up to the point
next
it added to the picture.Which implies something
next
is doing is likely the root cause.Combined with remarkjs/remark-math#80 it leads me to believe something about Next SSR messes with Katex and Mathjax.
Remark and MDX just happen to also be in the dependency tree, but seem to be unrelated to the issues being seen.
Originally posted by @ChristianMurphy in remarkjs/remark-math#81 (comment)
I try to use CSR with Next https://stackblitz.com/edit/nextjs-ftepsg?file=pages%2Findex.js, and it's still not working. I believe somehow nextjs cannot get the context of
import "katex/dist/contrib/mhchem";
Additional information
No response
Example
vanilla js
https://codesandbox.io/s/katex-mhchem-wl7q64
react
https://stackblitz.com/edit/stackblitz-starters-ueq3rk?file=src%2FApp.tsx
next
https://stackblitz.com/edit/nextjs-xvqkxb?file=pages/index.js
next csr
https://stackblitz.com/edit/nextjs-ftepsg?file=pages%2Findex.js
Beta Was this translation helpful? Give feedback.
All reactions