next.js mdx渲染问题与备注和rehype-katex

发布于 2025-02-07 07:01:44 字数 808 浏览 3 评论 0原文

我在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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一身仙ぐ女味 2025-02-14 07:01:44

我认为您应该使用$$ 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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文