Fumadocs

组件

用于改进文档的附加组件

概览

🌐 Overview

你可以使用的其他组件:

🌐 Additional components that you can use:

MDX 组件

🌐 MDX Components

默认的 MDX 组件包括卡片、提示、代码块和标题。

🌐 The default MDX components include Cards, Callouts, Code Blocks and Headings.

import defaultMdxComponents from 'fumadocs-ui/mdx';

🌐 Relative Link

仅限服务器组件。

要在 href 中支持相对文件路径的链接,请使用以下方法覆盖默认的 a 组件:

🌐 To support links with relative file path in href, override the default a component with:

app/docs/[[...slug]]/page.tsx
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { source } from '@/lib/source';
import { getMDXComponents } from '@/mdx-components';

const page = source.getPage(['...']);

return (
  <MdxContent
    components={getMDXComponents({
      // override the `a` tag
      a: createRelativeLink(source, page),
    })}
  />
);
[My Link](./file.mdx)

示例: ../../(integrations)/feedback.mdx

Last updated on

On this page