next.js mdx渲染问题与备注和rehype-katex
我在Next.js项目中使用React-Math和Rehype-Katex插件中的MDX。 当我呈现MDX文件时,它会给我带来错误:
“乳胶兼容输入和严格模式设置为'warn':在latex,\或\ newline中在显示模式[newlineindisplaymode]中无能
为文件。
import nextMDX from '@next/mdx';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
const nextConfig = {
reactStrictMode: true,
};
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
// If you use `MDXProvider`, uncomment the following line.
providerImportSource: '@mdx-js/react',
},
});
export default withMDX({
// Append the default value with md extensions
nextConfig,
pageExtensions: ['js', 'jsx', 'md', 'mdx'],
});
有人知道如何解决此问题或关闭严格的模式警告? 谢谢 !
I am using MDX in my NEXT.JS project with the react-math and rehype-katex plugins.
When I render the MDX files it gives me errors:
"LaTeX-incompatible input and strict mode is set to 'warn': In LaTeX, \ or \newline does nothing in display mode [newLineInDisplayMode]"
Flowing are my next.config.mjs file.
import nextMDX from '@next/mdx';
import remarkMath from 'remark-math';
import rehypeKatex from 'rehype-katex';
const nextConfig = {
reactStrictMode: true,
};
const withMDX = nextMDX({
extension: /\.mdx?$/,
options: {
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeKatex],
// If you use `MDXProvider`, uncomment the following line.
providerImportSource: '@mdx-js/react',
},
});
export default withMDX({
// Append the default value with md extensions
nextConfig,
pageExtensions: ['js', 'jsx', 'md', 'mdx'],
});
Any one knows how can I fix this or turn off the strict mode warnings?
Thanks !
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为您应该使用$$ latex content $$应用
ex:
$$
p(y = 1 | x; w)= \ frac {1} {1 + e^{ - w^t x}} = \ sigma( w^t x)
$$
在此处输入图像描述
i think you should use $$ latex content $$ for applying
ex :
$$
P(y = 1 | x; w) = \frac{1}{1 + e^{-w^T x}} = \sigma(w^T x)
$$
enter image description here