Comments (9)
This error disappears when commenting out lines 113-115 in https://github.com/remarkjs/remark-math/blob/7e82f934e77d62b7366825633bc7f1d5d5e5a861/packages/rehype-mathjax/lib/create-plugin.js
if (found && renderer.styleSheet) {
context.children.push(renderer.styleSheet())
}
Though it's still unclear where the root cause is
from remark-math.
well, the root cause is that there is different handling on the server (JSDOM) and a browser (depending on which one your users use). Not sure it can be change,d but feel free to investigate it.
from remark-math.
I'm having this problem too. One thing I've noticed is that if you inspect a mathjax-generated element, you'll see something like this: <mjx-container classname="MathJax ...>
It should say class=
, not classname=
when you're inspecting in the browser. For some reason, when combined with MDX, it doesn't properly convert that attribute. If I don't use MDX and use Next.js directly, it works fine, so it has something to do with remark-math and MDX together, I think.
from remark-math.
That seems like a very different problem? The above seems to talk about CSS, you seem to talk about (MathML) attribute conversion?
from remark-math.
I'm not talking about MathML, at least I don't think I am.
I'm talking about how rehype-mathjax renders the HTML. Just suggesting a possible cause of the hydration error. If somehow it was being rendered as "class" on the server but "classname" on the client, I think that could cause the hydration error.
Interestingly, when I commented out the lines OP suggested, I still got the error. If I switch to rehype-katex the problem goes away.
from remark-math.
oh sorry yeah you’re right, mjx-container
is a custom element, not mathml.
when I commented out the lines OP suggested, I still got the error
Yeah, I thought it was a different problem, and this seems to indicate that.
If I switch to rehype-katex the problem goes away.
It does thing completely differently!
from remark-math.
Can confirm this issue still exists with Next.js 14
from remark-math.
Can confirm that this solution that avoids adding the css appears to work.
from remark-math.
Related Issues (20)
- rehype-katex fails with new NextJS TypeScript Project HOT 5
- invalid javascript @ generated object keys HOT 21
- The dollar sign is not showing in single $ quote HOT 6
- rehype-mathjax should not have a dependency on @types/web HOT 13
- Generate (`pre` and) `code` elements instead of `div`, `span` HOT 1
- Hard break identifier immediately preceding $$ is not registered as a hard break. HOT 6
- Add mhchem support to rehype-katex HOT 14
- `rehype-katex` does not catch non-parse errors HOT 7
- Math and Katex renders incorrectly HOT 2
- remark-katex @mdx-js/rollup integration HOT 7
- rehype-mathjax: CHTML not rendering HOT 10
- Update KaTeX types HOT 5
- Mathjax Docs are Incorrect Due to Removal of index.js HOT 3
- MathJax error -- TypeError: Cannot read properties of null (reading '4') HOT 11
- Cannot read properties of undefined (reading 'mathFlowInside') HOT 14
- [Nuxt MDC] reading 'mathFlowInside' undefined when parsing a multi-line formula HOT 4
- Older version of `jsdom` (<23) causes deprecation warnings HOT 5
- Add a rehype plugin to use mathlive renderer HOT 3
- rehype-katex breaks in production build HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remark-math.