prmbr-image-mksaas/content/docs/mdx/index.zh.mdx
javayhu fe04a2973e feat: add new documentation files for zh locale
- Introduced multiple new MDX files covering various topics including comparisons, customization, internationalization, manual installation, markdown usage, and component documentation.
- Enhanced the overall structure and organization of the documentation to improve user experience and accessibility.
- Added a meta JSON file to define the documentation structure and navigation.
- Implemented new layout files for different document types, improving the flexibility of the documentation framework.
2025-04-01 00:38:07 +08:00

41 lines
785 B
Plaintext

---
title: MDX
description: 默认 MDX 组件
index: true
---
## 使用方法
默认的 MDX 组件包括卡片、提示框、代码块和标题。
```ts
import defaultMdxComponents from 'fumadocs-ui/mdx';
```
### 相对链接
要支持 `href` 中带有相对文件路径的链接,请使用以下方式覆盖默认的 `a` 组件:
```tsx
import { createRelativeLink } from 'fumadocs-ui/mdx';
import { source } from '@/lib/source';
const page = source.getPage(['...']);
return (
<MdxContent
components={{
// override the `a` tag
a: createRelativeLink(source, page),
}}
/>
);
```
```mdx
[My Link](./file.mdx)
```
[示例: `../(integrations)/open-graph.mdx`](<../(integrations)/open-graph.mdx>)
<Callout type="warn">仅限服务器组件。</Callout>