Fumadocs

备注 警告

在 Fumadocs 中使用警示

在 Docusaurus 中,有一种 警告语法

🌐 In Docusaurus, there's an Admonition syntax.

对于从 Docusaurus 迁移过来的人,你可以启用这个 remark 插件以支持 Admonition 语法。

🌐 For people migrating from Docusaurus, you can enable this remark plugin to support the Admonition syntax.

使用

🌐 Usage

它需要 remark-directive 才能工作。

🌐 It requires remark-directive to work.

npm i remark-directive

在你的配置中配置两个插件。

🌐 Configure both plugins in your config.

source.config.ts
import remarkDirective from 'remark-directive';
import { remarkDirectiveAdmonition } from 'fumadocs-core/mdx-plugins';
import { defineConfig } from 'fumadocs-mdx/config';

export default defineConfig({
  mdxOptions: {
    remarkPlugins: [remarkDirective, remarkDirectiveAdmonition],
  },
});

例子

🌐 Example

:::tip[This is a `title`]

Hello World

:::

:::warning

Hello World

:::

何时使用

🌐 When to use

我们强烈推荐改用 MDX 的 JSX 语法。它更灵活,并且一些编辑器在 MDX 文件中支持智能感知。

🌐 We highly recommend using the JSX syntax of MDX instead. It's more flexible, some editors support IntelliSense in MDX files.

<Callout type='warn'>

Hello World

</Callout>

Last updated on

On this page