rehype-mathjax hydration issue with Next.js #2286
-
I’ve already posted this question on Stack Overflow for about a day without a response, so I’m posting it here in hopes of someone understanding how to solve it. I’ve set up MDX with Next.js and I’m able to use it to set up pages. I’m also able to add plugins to remark and rehype through MathJax is being processed on the server side, but I’m seeing problems in my generated HTML markup where <mjx-c className="mjx-c2212"></mjx-c> This issue appears in a Next app, so you can reproduce the issue by using import nextMDX from "@next/mdx";
import remarkMath from "remark-math";
import rehypeMathjaxChtml from "./rehype-mathjax/chtml.js";
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkGfm, remarkMath],
rehypePlugins: [
[
rehypeMathjaxChtml,
{
chtml: {
fontURL:
"https://cdn.jsdelivr.net/npm/mathjax@3/es5/output/chtml/fonts/woff-v2",
},
},
],
],
},
});
const nextConfig = {
pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
reactStrictMode: true,
};
export default withMDX(nextConfig); Create a page such as |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
See also remarkjs/remark-math#80. |
Beta Was this translation helpful? Give feedback.
See also remarkjs/remark-math#80.