diff --git a/content/docs/components/accordion.mdx b/content/docs/components/accordion.mdx deleted file mode 100644 index 4d95995..0000000 --- a/content/docs/components/accordion.mdx +++ /dev/null @@ -1,43 +0,0 @@ ---- -title: Accordion -description: Add Accordions to your documentation -preview: accordion ---- - -## Usage - -Based on -[Radix UI Accordion](https://www.radix-ui.com/primitives/docs/components/accordion), useful for FAQ sections. - -```tsx -import React from 'react'; -import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; - - - My Content -; -``` - -### Accordions - -{/* */} - -### Accordion - -{/* */} - -### Linking to Accordion - -You can specify an `id` for accordion. The accordion will automatically open when the user is navigating to the page with the specified `id` in hash parameter. - -```mdx - - - -My Content - - - -``` - -> The value of accordion is same as title by default. When an id presents, it will be used as the value instead. diff --git a/content/docs/components/accordion.zh.mdx b/content/docs/components/accordion.zh.mdx deleted file mode 100644 index fe608e1..0000000 --- a/content/docs/components/accordion.zh.mdx +++ /dev/null @@ -1,42 +0,0 @@ ---- -title: 手风琴 -description: 在文档中添加手风琴组件 -preview: accordion ---- - -## 使用方法 - -基于 [Radix UI Accordion](https://www.radix-ui.com/primitives/docs/components/accordion),对 FAQ 部分特别有用。 - -```tsx -import React from 'react'; -import { Accordion, Accordions } from 'fumadocs-ui/components/accordion'; - - - 我的内容 -; -``` - -### Accordions - -{/* */} - -### Accordion - -{/* */} - -### 链接到手风琴 - -您可以为手风琴指定一个 `id`。当用户导航到带有指定 `id` 的哈希参数的页面时,手风琴将自动打开。 - -```mdx - - - -我的内容 - - - -``` - -> 手风琴的值默认与标题相同。当存在 id 时,它将被用作值。 \ No newline at end of file diff --git a/content/docs/components/banner.mdx b/content/docs/components/banner.mdx deleted file mode 100644 index 500b173..0000000 --- a/content/docs/components/banner.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: Banner -description: Add a banner to your site -preview: banner ---- - -## Usage - -Put the element at the top of your root layout, you can use it for displaying announcements. - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}): React.ReactElement { - return ( - - - Hello World - {children} - - - ); -} -``` - -### Variant - -Change the default variant. - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -Hello World; -``` - -### Change Layout - -By default, the banner uses a `style` tag to modify Fumadocs layouts (e.g. reduce the sidebar height). -You can disable it with: - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -Hello World; -``` - -### Close - -To allow users to close the banner, give the banner an ID. - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -Hello World; -``` - -The state will be automatically persisted. diff --git a/content/docs/components/banner.zh.mdx b/content/docs/components/banner.zh.mdx deleted file mode 100644 index 558c232..0000000 --- a/content/docs/components/banner.zh.mdx +++ /dev/null @@ -1,61 +0,0 @@ ---- -title: 横幅 -description: 在您的网站添加横幅 -preview: banner ---- - -## 使用方法 - -将元素放在根布局的顶部,您可以用它来显示公告。 - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -export default function RootLayout({ - children, -}: { - children: React.ReactNode; -}): React.ReactElement { - return ( - - - Hello World - {children} - - - ); -} -``` - -### 变体 - -更改默认变体。 - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -Hello World; -``` - -### 更改布局 - -默认情况下,横幅使用 `style` 标签来修改 Fumadocs 布局(例如减少侧边栏高度)。 -您可以通过以下方式禁用它: - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -Hello World; -``` - -### 关闭 - -要允许用户关闭横幅,请给横幅一个 ID。 - -```tsx -import { Banner } from 'fumadocs-ui/components/banner'; - -Hello World; -``` - -状态将自动保持。 \ No newline at end of file diff --git a/content/docs/components/dynamic-codeblock.mdx b/content/docs/components/dynamic-codeblock.mdx deleted file mode 100644 index d7ea276..0000000 --- a/content/docs/components/dynamic-codeblock.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: Code Block (Dynamic) -description: A codeblock that also highlights code -preview: dynamicCodeBlock ---- - -## Usage - -```tsx -import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock'; - -; -``` - -This component, different from the MDX [`CodeBlock`](/docs/mdx/codeblock) component, can be used without MDX. -It highlights the code with Shiki and use the default component to render it. - -Features: - -- Can be pre-rendered on server -- load languages and themes on browser lazily - -### Options - -```tsx -import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock'; - -; -``` diff --git a/content/docs/components/dynamic-codeblock.zh.mdx b/content/docs/components/dynamic-codeblock.zh.mdx deleted file mode 100644 index 13fed15..0000000 --- a/content/docs/components/dynamic-codeblock.zh.mdx +++ /dev/null @@ -1,38 +0,0 @@ ---- -title: 代码块(动态) -description: 也能高亮代码的代码块 -preview: dynamicCodeBlock ---- - -## 使用方法 - -```tsx -import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock'; - -; -``` - -这个组件与 MDX [`CodeBlock`](/docs/mdx/codeblock) 组件不同,可以在不使用 MDX 的情况下使用。 -它使用 Shiki 高亮代码,并使用默认组件渲染它。 - -特点: - -- 可以在服务器上预渲染 -- 在浏览器上懒加载语言和主题 - -### 选项 - -```tsx -import { DynamicCodeBlock } from 'fumadocs-ui/components/dynamic-codeblock'; - -; -``` \ No newline at end of file diff --git a/content/docs/components/files.mdx b/content/docs/components/files.mdx deleted file mode 100644 index 0873bde..0000000 --- a/content/docs/components/files.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: Files -description: Display file structure in your documentation -preview: 'files' ---- - -## Usage - -Wrap file components in `Files`. - -```mdx -import { File, Folder, Files } from 'fumadocs-ui/components/files'; - - - - - - - - - - - - - - -``` - -### File - -{/* */} - -### Folder - -{/* */} diff --git a/content/docs/components/files.zh.mdx b/content/docs/components/files.zh.mdx deleted file mode 100644 index 48b124b..0000000 --- a/content/docs/components/files.zh.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: 文件 -description: 在文档中显示文件结构 -preview: 'files' ---- - -## 使用方法 - -将文件组件包装在 `Files` 中。 - -```mdx -import { File, Folder, Files } from 'fumadocs-ui/components/files'; - - - - - - - - - - - - - - -``` - -### File - -{/* */} - -### Folder - -{/* */} \ No newline at end of file diff --git a/content/docs/components/github-info.mdx b/content/docs/components/github-info.mdx deleted file mode 100644 index fa76172..0000000 --- a/content/docs/components/github-info.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: GitHub Info -description: Display your GitHub repository information -preview: githubInfo ---- - -## Usage - -```tsx -import { GithubInfo } from 'fumadocs-ui/components/github-info'; - -; -``` - -It's recommended to add it to your docs layout with `links` option: - -```tsx title="app/docs/layout.tsx" -import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/notebook'; -import type { ReactNode } from 'react'; -import { baseOptions } from '@/app/layout.config'; -import { source } from '@/lib/source'; -import { GithubInfo } from 'fumadocs-ui/components/github-info'; - -const docsOptions: DocsLayoutProps = { - ...baseOptions, - tree: source.pageTree, - links: [ - { - type: 'custom', - children: ( - - ), - }, - ], -}; - -export default function Layout({ children }: { children: ReactNode }) { - return {children}; -} -``` diff --git a/content/docs/components/github-info.zh.mdx b/content/docs/components/github-info.zh.mdx deleted file mode 100644 index a8684b6..0000000 --- a/content/docs/components/github-info.zh.mdx +++ /dev/null @@ -1,45 +0,0 @@ ---- -title: GitHub 信息 -description: 显示您的 GitHub 仓库信息 -preview: githubInfo ---- - -## 使用方法 - -```tsx -import { GithubInfo } from 'fumadocs-ui/components/github-info'; - -; -``` - -建议将其添加到您的文档布局中,使用 `links` 选项: - -```tsx title="app/docs/layout.tsx" -import { DocsLayout, type DocsLayoutProps } from 'fumadocs-ui/layouts/notebook'; -import type { ReactNode } from 'react'; -import { baseOptions } from '@/app/layout.config'; -import { source } from '@/lib/source'; -import { GithubInfo } from 'fumadocs-ui/components/github-info'; - -const docsOptions: DocsLayoutProps = { - ...baseOptions, - tree: source.pageTree, - links: [ - { - type: 'custom', - children: ( - - ), - }, - ], -}; - -export default function Layout({ children }: { children: ReactNode }) { - return {children}; -} -``` \ No newline at end of file diff --git a/content/docs/components/image-zoom.mdx b/content/docs/components/image-zoom.mdx deleted file mode 100644 index 97f34a1..0000000 --- a/content/docs/components/image-zoom.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Zoomable Image -description: Allow zoom-in images in your documentation -preview: zoomImage ---- - -## Usage - -Replace `img` with `ImageZoom` in your MDX components. - -```tsx title="app/docs/[[...slug]]/page.tsx" -import { ImageZoom } from 'fumadocs-ui/components/image-zoom'; -import defaultMdxComponents from 'fumadocs-ui/mdx'; - -return ( - , - // other Mdx components - }} - /> -); -``` - -Now image zoom will be automatically enabled on all images. - -```mdx -![Test](/banner.png) -``` - -### Image Optimization - -A default [`sizes` property](https://nextjs.org/docs/app/api-reference/components/image#sizes) will be defined for Next.js `` component if not specified. diff --git a/content/docs/components/image-zoom.zh.mdx b/content/docs/components/image-zoom.zh.mdx deleted file mode 100644 index 0f0c5c8..0000000 --- a/content/docs/components/image-zoom.zh.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: 可缩放图片 -description: 在文档中允许放大图片 -preview: zoomImage ---- - -## 使用方法 - -在 MDX 组件中用 `ImageZoom` 替换 `img`。 - -```tsx title="app/docs/[[...slug]]/page.tsx" -import { ImageZoom } from 'fumadocs-ui/components/image-zoom'; -import defaultMdxComponents from 'fumadocs-ui/mdx'; - -return ( - , - // 其他 Mdx 组件 - }} - /> -); -``` - -现在,所有图片都将自动启用图片缩放功能。 - -```mdx -![Test](/banner.png) -``` - -### 图片优化 - -如果未指定,将为 Next.js `` 组件定义默认的 [`sizes` 属性](https://nextjs.org/docs/app/api-reference/components/image#sizes)。 \ No newline at end of file diff --git a/content/docs/components/index.mdx b/content/docs/components/index.mdx deleted file mode 100644 index e7b7476..0000000 --- a/content/docs/components/index.mdx +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: Components -description: Additional components to improve your docs -index: true ---- diff --git a/content/docs/components/index.zh.mdx b/content/docs/components/index.zh.mdx deleted file mode 100644 index e49d3de..0000000 --- a/content/docs/components/index.zh.mdx +++ /dev/null @@ -1,5 +0,0 @@ ---- -title: 组件 -description: 改进文档的额外组件 -index: true ---- \ No newline at end of file diff --git a/content/docs/components/inline-toc.mdx b/content/docs/components/inline-toc.mdx deleted file mode 100644 index 2ef1ced..0000000 --- a/content/docs/components/inline-toc.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: Inline TOC -description: Add Inline TOC into your documentation -preview: inlineTOC ---- - -## Usage - -Pass TOC items to the component. - -```mdx -import { InlineTOC } from 'fumadocs-ui/components/inline-toc'; - - -``` - -### Use in Pages - -You can add inline TOC into every page. - -```tsx - - ... - - ... - -``` - -## Reference - -{/* */} diff --git a/content/docs/components/inline-toc.zh.mdx b/content/docs/components/inline-toc.zh.mdx deleted file mode 100644 index 73e42a2..0000000 --- a/content/docs/components/inline-toc.zh.mdx +++ /dev/null @@ -1,31 +0,0 @@ ---- -title: 内联目录 -description: 在文档中添加内联目录 -preview: inlineTOC ---- - -## 使用方法 - -将 TOC 项目传递给组件。 - -```mdx -import { InlineTOC } from 'fumadocs-ui/components/inline-toc'; - - -``` - -### 在页面中使用 - -您可以在每个页面中添加内联目录。 - -```tsx - - ... - - ... - -``` - -## 参考 - -{/* */} \ No newline at end of file diff --git a/content/docs/components/root-toggle.mdx b/content/docs/components/root-toggle.mdx deleted file mode 100644 index f4725b4..0000000 --- a/content/docs/components/root-toggle.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: Root Toggle -description: Switch between page trees -preview: rootToggle ---- - -## Usages - -Add this component to your sidebar or other places you want. - -```tsx -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; -import { RootToggle } from 'fumadocs-ui/components/layout/root-toggle'; - - - ), - }} -/>; -``` diff --git a/content/docs/components/root-toggle.zh.mdx b/content/docs/components/root-toggle.zh.mdx deleted file mode 100644 index 85f568f..0000000 --- a/content/docs/components/root-toggle.zh.mdx +++ /dev/null @@ -1,35 +0,0 @@ ---- -title: 根切换器 -description: 在页面树之间切换 -preview: rootToggle ---- - -## 使用方法 - -将此组件添加到您的侧边栏或您想要的其他地方。 - -```tsx -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; -import { RootToggle } from 'fumadocs-ui/components/layout/root-toggle'; - - - ), - }} -/>; -``` \ No newline at end of file diff --git a/content/docs/components/steps.mdx b/content/docs/components/steps.mdx deleted file mode 100644 index 54e3e39..0000000 --- a/content/docs/components/steps.mdx +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: Steps -description: Adding steps to your docs -preview: steps ---- - -## Usage - -Put your steps into the `Steps` container. - -```mdx -import { Step, Steps } from 'fumadocs-ui/components/steps'; - - - - -### Hello World - - - - - -### Hello World - - - -``` - -> We recommend using Tailwind CSS utility classes directly on Tailwind CSS projects. - -### Without imports - -You can use the Tailwind CSS utilities without importing it. - -```mdx -
-
-
-``` - -It supports adding step styles to only headings with arbitrary variants. - -```mdx -
- -### Hello World - -
-``` - -
- -### Hello World - -You no longer need to use the step component anymore. - -
diff --git a/content/docs/components/steps.zh.mdx b/content/docs/components/steps.zh.mdx deleted file mode 100644 index af1b320..0000000 --- a/content/docs/components/steps.zh.mdx +++ /dev/null @@ -1,57 +0,0 @@ ---- -title: 步骤 -description: 在文档中添加步骤 -preview: steps ---- - -## 使用方法 - -将您的步骤放入 `Steps` 容器中。 - -```mdx -import { Step, Steps } from 'fumadocs-ui/components/steps'; - - - - -### 你好世界 - - - - - -### 你好世界 - - - -``` - -> 我们建议在 Tailwind CSS 项目中直接使用 Tailwind CSS 实用类。 - -### 不使用导入 - -您可以在不导入的情况下使用 Tailwind CSS 实用工具。 - -```mdx -
-
-
-``` - -它支持仅对带有任意变体的标题添加步骤样式。 - -```mdx -
- -### 你好世界 - -
-``` - -
- -### 你好世界 - -您不再需要使用步骤组件了。 - -
\ No newline at end of file diff --git a/content/docs/components/tabs.mdx b/content/docs/components/tabs.mdx deleted file mode 100644 index c6955b6..0000000 --- a/content/docs/components/tabs.mdx +++ /dev/null @@ -1,146 +0,0 @@ ---- -title: Tabs -description: - A Tabs component built with Radix UI, with additional features such as - persistent and shared value. -preview: tabs ---- - -## Usage - -Import it in your MDX documents. - -```mdx -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; - - - Javascript is weird - Rust is fast - -``` - -### Without `value` - -Without a `value`, it detects from the children index. Note that it might cause errors on re-renders, it's not encouraged if the tabs might change. - -```mdx -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; - - - Javascript is weird - Rust is fast - -``` - -#### Demo with Re-renders - - - Javascript is weird - Rust is fast - - -{/* */} - -### Shared Value - -By passing an `groupId` property, you can share a value across all tabs with the same -id. - -```mdx - - Javascript is weird - Rust is fast - -``` - -### Persistent - -You can enable persistent by passing a `persist` property. The value will be -stored in `localStorage`, with its id as the key. - -```mdx - - Javascript is weird - Rust is fast - -``` - -> Persistent only works if you have passed an `id`. - -### Default Value - -Set a default value by passing `defaultIndex`. - -```mdx - - Javascript is weird - Rust is fast - -``` - -### Link to Tab - -Use HTML `id` attribute to link to a specific tab. - -```mdx - - Javascript is weird - Rust is fast - - `Hello World` - - -``` - -You can add the hash `#tab-cpp` to your URL and reload, the C++ tab will be activated. - - - Javascript is weird - Rust is fast - - `Hello World` - - - -Additionally, the `updateAnchor` property can be set to `true` in the `Tabs` component -to automatically update the URL hash whenever time a new tab is selected: - -```mdx - - - Javascript is weird - - - Rust is fast - - - `Hello World` - - -``` - -{/* */} - - - - Hello! - - - World! - - - -### Advanced - -You can use the styled Radix UI primitive directly from exported `Primitive`. - -```mdx -import { Primitive } from 'fumadocs-ui/components/tabs'; - - - - - - - -``` diff --git a/content/docs/components/tabs.zh.mdx b/content/docs/components/tabs.zh.mdx deleted file mode 100644 index 7d3f0ed..0000000 --- a/content/docs/components/tabs.zh.mdx +++ /dev/null @@ -1,114 +0,0 @@ ---- -title: 选项卡 -description: - 使用 Radix UI 构建的选项卡组件,具有持久性和共享值等附加功能。 -preview: tabs ---- - -## 使用方法 - -在 MDX 文档中导入它。 - -```mdx -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; - - - Javascript 很奇怪 - Rust 很快 - -``` - -### 不使用 `value` - -如果没有 `value`,它会从子元素索引中检测。请注意,这可能会在重新渲染时导致错误,如果选项卡可能会改变,不建议这样做。 - -```mdx -import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; - - - Javascript 很奇怪 - Rust 很快 - -``` - -### 共享值 - -通过传递 `groupId` 属性,您可以在具有相同 ID 的所有选项卡之间共享值。 - -```mdx - - Javascript 很奇怪 - Rust 很快 - -``` - -### 持久性 - -您可以通过传递 `persist` 属性启用持久性。该值将存储在 `localStorage` 中,以其 ID 作为键。 - -```mdx - - Javascript 很奇怪 - Rust 很快 - -``` - -> 持久性仅在您传递了 `id` 时有效。 - -### 默认值 - -通过传递 `defaultIndex` 设置默认值。 - -```mdx - - Javascript 很奇怪 - Rust 很快 - -``` - -### 链接到选项卡 - -使用 HTML `id` 属性链接到特定选项卡。 - -```mdx - - Javascript 很奇怪 - Rust 很快 - - `Hello World` - - -``` - -您可以在 URL 中添加哈希 `#tab-cpp` 并重新加载,C++ 选项卡将被激活。 - -此外,可以在 `Tabs` 组件中将 `updateAnchor` 属性设置为 `true`,以便在每次选择新选项卡时自动更新 URL 哈希: - -```mdx - - - Javascript 很奇怪 - - - Rust 很快 - - - `Hello World` - - -``` - -### 高级用法 - -您可以直接从导出的 `Primitive` 中使用样式化的 Radix UI 原语。 - -```mdx -import { Primitive } from 'fumadocs-ui/components/tabs'; - - - - - - - -``` \ No newline at end of file diff --git a/content/docs/components/type-table.mdx b/content/docs/components/type-table.mdx deleted file mode 100644 index 497cce5..0000000 --- a/content/docs/components/type-table.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: Type Table -description: A table for documenting types -preview: typeTable ---- - -## Usage - -It accepts a `type` property. - -```mdx -import { TypeTable } from 'fumadocs-ui/components/type-table'; - - -``` - -## References - -### Type Table - -{/* */} - -### Object Type - -{/* */} diff --git a/content/docs/components/type-table.zh.mdx b/content/docs/components/type-table.zh.mdx deleted file mode 100644 index f51089b..0000000 --- a/content/docs/components/type-table.zh.mdx +++ /dev/null @@ -1,34 +0,0 @@ ---- -title: 类型表格 -description: 用于记录类型的表格 -preview: typeTable ---- - -## 使用方法 - -它接受一个 `type` 属性。 - -```mdx -import { TypeTable } from 'fumadocs-ui/components/type-table'; - - -``` - -## 参考 - -### Type Table - -{/* */} - -### Object Type - -{/* */} \ No newline at end of file diff --git a/content/docs/layouts/docs.mdx b/content/docs/layouts/docs.mdx deleted file mode 100644 index c429b89..0000000 --- a/content/docs/layouts/docs.mdx +++ /dev/null @@ -1,166 +0,0 @@ ---- -title: Docs Layout -description: The layout of documentation ---- - -The layout of documentation pages, it includes a sidebar and mobile-only navbar. - -> It is a server component, you should not reference it in a client component. - -## Usage - -Pass your page tree to the component. - -```tsx title="layout.tsx" -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; -import { baseOptions } from '@/app/layout.config'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return ( - - {children} - - ); -} -``` - -{/* */} - -## Sidebar - -```tsx title="layout.tsx" -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; - -; -``` - -{/* */} - -### Sidebar Tabs - -See [Navigation Guide](/docs/navigation/sidebar#sidebar-tabs) for usages. - -#### Decoration - -Change the icon/styles of tabs. - -```tsx -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; - - ({ - ...option, - icon: 'my icon', - }), - }, - }} -/>; -``` - -## Nav - -A mobile-only navbar, we recommend to customise it from `baseOptions`. - -
- -![Docs Nav](/images/docs/docs-nav.png) - -
- -```tsx -import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'; - -export const baseOptions: BaseLayoutProps = { - githubUrl: 'https://github.com/fuma-nama/fumadocs', - nav: { - title: 'My App', - }, -}; -``` - -{/* */} - -### Transparent Mode - -To make the navbar background transparent, you can configure transparent mode. - -```tsx -import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'; - -export const baseOptions: BaseLayoutProps = { - nav: { - transparentMode: 'top', - }, -}; -``` - -| Mode | Description | -| -------- | ---------------------------------------- | -| `always` | Always use a transparent background | -| `top` | When at the top of page | -| `none` | Disable transparent background (default) | - -### Replace Navbar - -To replace the navbar in Docs Layout, set `nav.component` to your own component. - -```tsx title="layout.tsx" -import { baseOptions } from '@/app/layout.config'; -import { DocsLayout } from 'fumadocs-ui/layouts/notebook'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return ( - , - }} - > - {children} - - ); -} -``` - -Fumadocs uses **CSS Variables** to share the size of layout components, and fit each layout component into appropriate position. - -You need to override `--fd-nav-height` to the exact height of your custom navbar, this can be done with a CSS stylesheet (e.g. in `global.css`): - -```css -:root { - --fd-nav-height: 80px !important; -} -``` - -## Advanced - -### Disable Prefetching - -By default, it uses the Next.js Link component with prefetch enabled. -When the link component appears into the browser viewport, the content (RSC payload) will be prefetched. - -On Vercel, this may cause a high usage of serverless functions and Data Cache. -It can also hit the limits of some other hosting platforms. - -You can disable prefetching to reduce the amount of RSC requests. - -```tsx -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; - -; -``` diff --git a/content/docs/layouts/docs.zh.mdx b/content/docs/layouts/docs.zh.mdx deleted file mode 100644 index c3075f3..0000000 --- a/content/docs/layouts/docs.zh.mdx +++ /dev/null @@ -1,160 +0,0 @@ ---- -title: 文档布局 -description: 文档的布局 ---- - -文档页面的布局,它包括一个侧边栏和仅限移动设备的导航栏。 - -> 它是一个服务器组件,您不应该在客户端组件中引用它。 - -## 使用方法 - -将您的页面树传递给组件。 - -```tsx title="layout.tsx" -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; -import { baseOptions } from '@/app/layout.config'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return ( - - {children} - - ); -} -``` - -{/* */} - -## 侧边栏 - -```tsx title="layout.tsx" -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; - -; -``` - -{/* */} - -### 侧边栏标签 - -有关用法,请参见[导航指南](/docs/navigation/sidebar#sidebar-tabs)。 - -#### 装饰 - -更改标签的图标/样式。 - -```tsx -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; - - ({ - ...option, - icon: 'my icon', - }), - }, - }} -/>; -``` - -## 导航栏 - -一个仅限移动设备的导航栏,我们建议从 `baseOptions` 自定义它。 - -```tsx -import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'; - -export const baseOptions: BaseLayoutProps = { - githubUrl: 'https://github.com/fuma-nama/fumadocs', - nav: { - title: 'My App', - }, -}; -``` - -{/* */} - -### 透明模式 - -要使导航栏背景透明,您可以配置透明模式。 - -```tsx -import type { BaseLayoutProps } from 'fumadocs-ui/layouts/shared'; - -export const baseOptions: BaseLayoutProps = { - nav: { - transparentMode: 'top', - }, -}; -``` - -| 模式 | 描述 | -| -------- | ------------------------------ | -| `always` | 始终使用透明背景 | -| `top` | 在页面顶部时 | -| `none` | 禁用透明背景(默认) | - -### 替换导航栏 - -要替换文档布局中的导航栏,将 `nav.component` 设置为您自己的组件。 - -```tsx title="layout.tsx" -import { baseOptions } from '@/app/layout.config'; -import { DocsLayout } from 'fumadocs-ui/layouts/notebook'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return ( - , - }} - > - {children} - - ); -} -``` - -Fumadocs 使用 **CSS 变量**来共享布局组件的大小,并将每个布局组件放置在适当的位置。 - -您需要将 `--fd-nav-height` 覆盖为自定义导航栏的确切高度,这可以通过 CSS 样式表(例如在 `global.css` 中)完成: - -```css -:root { - --fd-nav-height: 80px !important; -} -``` - -## 高级 - -### 禁用预取 - -默认情况下,它使用启用了预取的 Next.js Link 组件。 -当链接组件出现在浏览器视口中时,内容(RSC 有效载荷)将被预取。 - -在 Vercel 上,这可能会导致大量使用无服务器函数和数据缓存。 -它也可能会达到一些其他托管平台的限制。 - -您可以禁用预取以减少 RSC 请求的数量。 - -```tsx -import { DocsLayout } from 'fumadocs-ui/layouts/docs'; - -; -``` \ No newline at end of file diff --git a/content/docs/layouts/home-layout.mdx b/content/docs/layouts/home-layout.mdx deleted file mode 100644 index 08a5cc7..0000000 --- a/content/docs/layouts/home-layout.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: Home Layout -description: Shared layout for other pages ---- - -## Usage - -Add a navbar and search dialog across other pages. - -```tsx title="/app/(home)/layout.tsx" -import { HomeLayout } from 'fumadocs-ui/layouts/home'; -import { baseOptions } from '@/app/layout.config'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return {children}; -} -``` - -Create a [Route Group](https://nextjs.org/docs/app/building-your-application/routing/route-groups) to share the same layout across multiple pages. - - - - - - - - - - - - - diff --git a/content/docs/layouts/home-layout.zh.mdx b/content/docs/layouts/home-layout.zh.mdx deleted file mode 100644 index 2dd56ef..0000000 --- a/content/docs/layouts/home-layout.zh.mdx +++ /dev/null @@ -1,33 +0,0 @@ ---- -title: 主页布局 -description: 其他页面的共享布局 ---- - -## 使用方法 - -在其他页面上添加导航栏和搜索对话框。 - -```tsx title="/app/(home)/layout.tsx" -import { HomeLayout } from 'fumadocs-ui/layouts/home'; -import { baseOptions } from '@/app/layout.config'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return {children}; -} -``` - -创建一个[路由组](https://nextjs.org/docs/app/building-your-application/routing/route-groups)来在多个页面之间共享相同的布局。 - - - - - - - - - - - - - \ No newline at end of file diff --git a/content/docs/layouts/notebook.mdx b/content/docs/layouts/notebook.mdx deleted file mode 100644 index 8c9df1b..0000000 --- a/content/docs/layouts/notebook.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: Notebook -description: A more compact version of Docs Layout ---- - -## Usage - -Enable the notebook layout with `fumadocs-ui/layouts/notebook`, it's a more compact layout than the default one. - -![Notebook](/images/docs/notebook.png) - -```tsx title="layout.tsx" -import { DocsLayout } from 'fumadocs-ui/layouts/notebook'; -import { baseOptions } from '@/app/layout.config'; -import { source } from '@/lib/source'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return ( - - {children} - - ); -} -``` diff --git a/content/docs/layouts/notebook.zh.mdx b/content/docs/layouts/notebook.zh.mdx deleted file mode 100644 index 356c009..0000000 --- a/content/docs/layouts/notebook.zh.mdx +++ /dev/null @@ -1,32 +0,0 @@ ---- -title: 笔记本 -description: 文档布局的更紧凑版本 ---- - -## 使用方法 - -使用 `fumadocs-ui/layouts/notebook` 启用笔记本布局,它比默认布局更加紧凑。 - -![Notebook](/images/docs/notebook.png) - -```tsx title="layout.tsx" -import { DocsLayout } from 'fumadocs-ui/layouts/notebook'; -import { baseOptions } from '@/app/layout.config'; -import { source } from '@/lib/source'; -import type { ReactNode } from 'react'; - -export default function Layout({ children }: { children: ReactNode }) { - return ( - - {children} - - ); -} -``` \ No newline at end of file diff --git a/content/docs/layouts/page.mdx b/content/docs/layouts/page.mdx deleted file mode 100644 index e4d2573..0000000 --- a/content/docs/layouts/page.mdx +++ /dev/null @@ -1,217 +0,0 @@ ---- -title: Docs Page -description: A page in your documentation ---- - -Page is the base element of a documentation, it includes Table of contents, -Footer, and Breadcrumb. - -## Usage - -```tsx title="page.tsx" -import { - DocsPage, - DocsDescription, - DocsTitle, - DocsBody, -} from 'fumadocs-ui/page'; - - - title - description - ... -; -``` - - - -Instead of rendering the title with `DocsTitle` in `page.tsx`, you can put the title into MDX file. -This will render the title in the MDX body. - - - -### Body - -It applies the [Typography](/docs/theme#typography) styles, wrap your content inside. - -```tsx -import { DocsBody } from 'fumadocs-ui/page'; - - -

This heading looks good!

-
; -``` - -### Category - -Optional, link the other pages in its (page tree) folder with cards. - -> You can use this component without ``. - -```tsx title="page.tsx" -import { source } from '@/lib/source'; -import { DocsCategory } from 'fumadocs-ui/page'; - -const page = source.getPage(['...']); - -; -``` - -**Demo:** - -{/* DocsCategory is not supported */} -{/* */} - -## Configurations - -### Full Mode - -To extend the page to fill up all available space, pass `full` to the page component. -This will force TOC to be shown as a popover. - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - -...; -``` - -### Table of Contents - -An overview of all the headings in your article, it requires an array of headings. - -For Markdown and MDX documents, You can obtain it using the -[TOC Utility](/docs/headless/utils/get-toc). Content sources like Fumadocs MDX offer this out-of-the-box. - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - -...; -``` - -Customise or disable TOC from your documentation with the `tableOfContent` option. - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - -...; -``` - -{/* */} - -#### Style - -You can choose another style for TOC, like `clerk` inspired by https://clerk.com: - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - - - ... -; -``` - -#### Popover Mode - -On smaller devices, it is shown on a popover instead. -Customise it with the `tableOfContentPopover` option. - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - -...; -``` - -{/* */} - -### Last Updated Time - -Display last updated time of the page. - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - -; -``` - -Since you might have different version controls (e.g. Github) or it's from -remote sources like Sanity, Fumadocs UI doesn't display the last updated time by -default. - -For Github hosted documents, you can use -the [`getGithubLastEdit`](/docs/headless/utils/git-last-edit) utility. - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; -import { getGithubLastEdit } from 'fumadocs-core/server'; - -const time = await getGithubLastEdit({ - owner: 'fuma-nama', - repo: 'fumadocs', - path: `content/docs/${page.file.path}`, -}); - -; -``` - - - - You can also specify the last updated time of documents (e.g. using frontmatter). - Don't forget to [update the schema type](/docs/mdx/collections#schema) on Fumadocs MDX first. - - - -### Edit on GitHub - -Add "Edit on GitHub" button to the page. - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - -; -``` - -### Footer - -Footer is a navigation element that has two buttons to jump to the next and previous pages. When not specified, it shows the neighbour pages found from page tree. - -Customise the footer with the `footer` option. - -```tsx -import { DocsPage, DocsBody } from 'fumadocs-ui/page'; - - - ... -; -``` - -{/* */} - -### Breadcrumb - -A navigation element, shown only when user is navigating in folders. - -{/* */} - -### MDX Page - -In conjunction of Fumadocs MDX, you may create a `page.mdx` file and add the following. - -```mdx -export { withArticle as default } from 'fumadocs-ui/page'; - -## Hello World -``` - -This creates a page with MDX, with proper typography styles applied. diff --git a/content/docs/layouts/page.zh.mdx b/content/docs/layouts/page.zh.mdx deleted file mode 100644 index fd5dea1..0000000 --- a/content/docs/layouts/page.zh.mdx +++ /dev/null @@ -1,238 +0,0 @@ ---- -title: 文档页面 -description: 文档中的页面 ---- - -可以渲染完整页面的组件(标题、目录等)。 - -## 正文 - -```tsx title="page.tsx" -import { DocsPage } from 'fumadocs-ui/page'; - -export default function Page({ params }: { params: { slug?: string[] } }) { - const page = getPage(params); - - return ( - - ); -} -``` - -{/* */} - -### SEO - -为页面添加 SEO 优化,有几种方法。首先,允许文档生成器提供 `metadata` 帮助程序: - -```tsx title="api.ts" -export { createMetadata } from 'fumadocs-core/docs'; -``` - -默认值包括 **标题**、**描述**、**开放图形**(Open Graph)和 **Twitter** 图片、**规范**(Canonical)URL 和 locale 元数据。 - -现在您可以直接使用它: - -```tsx title="page.tsx" -import type { Metadata } from 'next'; -import { createMetadata } from '@/app/api'; - -export async function generateMetadata({ - params, -}: { - params: { slug?: string[] }; -}): Promise { - const page = await getPage(params); - - return createMetadata({ - page, - params, - }); -} -``` - -或者您可以手动构建它: - -```tsx title="page.tsx" -import type { Metadata } from 'next'; -import { absoluteUrl } from 'fumadocs-core/utils/absolute-url'; - -export const metadata: Metadata = { - title: 'My Page', - description: 'Page Description', - openGraph: { - title: 'My Page', - description: 'Page Description', - type: 'article', - url: absoluteUrl('/docs/my-page'), - }, - twitter: { - title: 'My Page', - description: 'Page Description', - card: 'summary_large_image', - }, - alternates: { - canonical: absoluteUrl('/docs/my-page'), - }, -}; -``` - -## 内容目录 - -支持无限级别的标题。从页面内容中提取,您应该通过 `toc` 字段传递它。 - -```tsx title="page.tsx" -import { DocsPage } from 'fumadocs-ui/page'; -import { getToc } from 'fumadocs-core'; - -export default function Page() { - const toc = getToc(content); - - return ; -} -``` - -{/* */} - -### 自定义内容目录 - -可以定制 TOC(目录)的呈现方式,但您仍然需要通过 `toc` 字段传递真实的 TOC 项目。 - -```tsx title="page.tsx" -import { DocsPage } from 'fumadocs-ui/page'; - -export default function Page() { - return ( - -
Custom TOC
-
- ); -} -``` - -## 最后更新时间 - -```tsx title="page.tsx" -import { DocsPage } from 'fumadocs-ui/page'; - -export default function Page() { - return ; -} -``` - -## 页脚 - -```tsx title="layout.tsx" -import { DocsPage } from 'fumadocs-ui/page'; -import { baseOptions } from '@/app/layout.config'; - -export default function Page() { - return ( - - ); -} -``` - -### 使用基础配置 - -您可以创建一个 `baseOptions` 对象,用于所有页面和布局组件。 - -```tsx title="layout.config.ts" -import type { BasePageConfig } from 'fumadocs-ui/page'; - -export const baseOptions: BasePageConfig = { - githubUrl: 'https://github.com/fuma-nama/fumadocs', - footer: { - text: 'Built with Fumadocs', - }, -}; -``` - -```tsx title="page.tsx" -import { DocsPage } from 'fumadocs-ui/page'; -import { baseOptions } from '@/app/layout.config'; - -export default function Page() { - return ; -} -``` - -### 编辑链接 - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; - -export default function Page() { - return ( - - ); -} -``` - -### 页面导航 - -```tsx -import { DocsPage } from 'fumadocs-ui/page'; -import { getPagesPath } from 'fumadocs-core'; - -export default function Page({ params }: { params: { slug?: string[] } }) { - const pagePath = getPagesPath(params); - const prev = getAdjacentPages({ current: pagePath, dir: 'prev' }); - const next = getAdjacentPages({ current: pagePath, dir: 'next' }); - - return ( - - ); -} -``` - -#### 自定义获取相邻页面 - -您可以在 `createAdjacentPages` 方法中应用 `includeInPageNav` 过滤器,该方法由文档生成器创建: - -```tsx title="api.ts" -import { createAdjacentPages } from 'fumadocs-core/docs'; -import { tree } from '@/app/source'; - -export const getAdjacentPages = createAdjacentPages(tree, { - includeInPageNav: (page) => !page.data.preview, -}); -``` \ No newline at end of file diff --git a/content/docs/layouts/root-provider.mdx b/content/docs/layouts/root-provider.mdx deleted file mode 100644 index 6c39b53..0000000 --- a/content/docs/layouts/root-provider.mdx +++ /dev/null @@ -1,54 +0,0 @@ ---- -title: Root Provider -description: The context provider of Fumadocs UI. ---- - -The context provider of all the components, including `next-themes` and context -for search dialog. It should be located at the root layout. - -## Usage - -```jsx -import { RootProvider } from 'fumadocs-ui/provider'; - -export default function Layout({ children }) { - return ( - - - {children} - - - ); -} -``` - -### Search Dialog - -Customize or disable the search dialog with `search` option. - -```jsx - - {children} - -``` - -Learn more from [Search](/docs/search). - -### Theme Provider - -Fumadocs supports light/dark modes with [`next-themes`](https://github.com/pacocoursey/next-themes). -Customise or disable it with `theme` option. - -```jsx - - {children} - -``` diff --git a/content/docs/layouts/root-provider.zh.mdx b/content/docs/layouts/root-provider.zh.mdx deleted file mode 100644 index 870bf2e..0000000 --- a/content/docs/layouts/root-provider.zh.mdx +++ /dev/null @@ -1,53 +0,0 @@ ---- -title: 根提供者 -description: Fumadocs UI 的上下文提供者 ---- - -所有组件的上下文提供者,包括 `next-themes` 和搜索对话框的上下文。它应该位于根布局中。 - -## 使用方法 - -```jsx -import { RootProvider } from 'fumadocs-ui/provider'; - -export default function Layout({ children }) { - return ( - - - {children} - - - ); -} -``` - -### 搜索对话框 - -使用 `search` 选项自定义或禁用搜索对话框。 - -```jsx - - {children} - -``` - -从[搜索](/docs/search)了解更多信息。 - -### 主题提供者 - -Fumadocs 通过 [`next-themes`](https://github.com/pacocoursey/next-themes) 支持明/暗模式。 -使用 `theme` 选项自定义或禁用它。 - -```jsx - - {children} - -``` \ No newline at end of file diff --git a/content/docs/mdx/callout.mdx b/content/docs/mdx/callout.mdx deleted file mode 100644 index f034b39..0000000 --- a/content/docs/mdx/callout.mdx +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: Callout -description: Add callout to your docs -preview: callout ---- - -## Usage - -Add it to your MDX components. - -```tsx -import { Callout } from 'fumadocs-ui/components/callout'; - -; -``` - -See [Markdown](/docs/markdown#callouts) for usages. - -### Reference - -{/* */} diff --git a/content/docs/mdx/callout.zh.mdx b/content/docs/mdx/callout.zh.mdx deleted file mode 100644 index 8e4c6b0..0000000 --- a/content/docs/mdx/callout.zh.mdx +++ /dev/null @@ -1,25 +0,0 @@ ---- -title: 提示框 -description: 在文档中添加提示框 -preview: callout ---- - -## 使用方法 - -将其添加到您的 MDX 组件中。 - -```tsx -import { Callout } from 'fumadocs-ui/components/callout'; - -; -``` - -有关用法,请参见 [Markdown](/docs/markdown#callouts)。 - -### 参考 - -{/* */} \ No newline at end of file diff --git a/content/docs/mdx/card.mdx b/content/docs/mdx/card.mdx deleted file mode 100644 index 23c8c01..0000000 --- a/content/docs/mdx/card.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: Card -description: Use the Card component in your MDX documentation -preview: card ---- - -## Usage - -Add it to your MDX components. - -```tsx -import { Card, Cards } from 'fumadocs-ui/components/card'; - -; -``` - -See [Markdown](/docs/markdown#cards) for usages. - -### Cards - -The container of cards. - -### Card - -Based on Next.js ``. - -{/* */} - - - -If you're not using Fumadocs MDX for rendering MDX (e.g. using Contentlayer), ensure that -tree shaking is working properly. - -Most of the icon libraries support importing icons individually. - -```tsx -import HomeIcon from 'lucide-react/dist/esm/icons/home'; -``` - -As a workaround, you can pass icons to MDX Components too. (this uses Next.js bundler instead of content source) - -```tsx title="page.tsx" -import { HomeIcon } from 'lucide-react'; - -const components = { - ...defaultComponents, - HomeIcon, -}; -``` - - diff --git a/content/docs/mdx/card.zh.mdx b/content/docs/mdx/card.zh.mdx deleted file mode 100644 index 9c4d9eb..0000000 --- a/content/docs/mdx/card.zh.mdx +++ /dev/null @@ -1,56 +0,0 @@ ---- -title: 卡片 -description: 在 MDX 文档中使用卡片组件 -preview: card ---- - -## 使用方法 - -将其添加到您的 MDX 组件中。 - -```tsx -import { Card, Cards } from 'fumadocs-ui/components/card'; - -; -``` - -有关用法,请参见 [Markdown](/docs/markdown#cards)。 - -### Cards - -卡片的容器。 - -### Card - -基于 Next.js 的 ``。 - -{/* */} - - - -如果您没有使用 Fumadocs MDX 来渲染 MDX(例如,使用 Contentlayer),请确保 -树摇优化正常工作。 - -大多数图标库支持单独导入图标。 - -```tsx -import HomeIcon from 'lucide-react/dist/esm/icons/home'; -``` - -作为解决方法,您也可以将图标传递给 MDX 组件。(这使用 Next.js 打包器而不是内容源) - -```tsx title="page.tsx" -import { HomeIcon } from 'lucide-react'; - -const components = { - ...defaultComponents, - HomeIcon, -}; -``` - - \ No newline at end of file diff --git a/content/docs/mdx/codeblock.mdx b/content/docs/mdx/codeblock.mdx deleted file mode 100644 index 1a4cee7..0000000 --- a/content/docs/mdx/codeblock.mdx +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: Code Block -description: Adding code blocks to your docs ---- - - -
- -```js title="config.js" -import createMDX from 'fumadocs-mdx/config'; - -const withMDX = createMDX(); - -// [!code word:config] -/** @type {import('next').NextConfig} */ -const config = { - // [!code highlight] - reactStrictMode: true, // [!code highlight] -}; // [!code highlight] - -export default withMDX(config); -``` - -
-
- -Display code blocks, added by default. - -- Copy button -- Custom titles and icons - -## Usage - -Wrap the pre element in ``, which acts as the wrapper of code block. - -```tsx -import { Pre, CodeBlock } from 'fumadocs-ui/components/codeblock'; - - ( - -
{props.children}
{/* [!code highlight] */} -
- ), - }} -/>; -``` - -See [Markdown](/docs/markdown#codeblock) for usages. - -### Keep Background - -Use the background color generated by Shiki (the Rehype Code plugin). - -```tsx -import { Pre, CodeBlock } from 'fumadocs-ui/components/codeblock'; - - ( - -
{props.children}
-
- ), - }} -/>; -``` - -### Icons - -Specify a custom icon by passing an `icon` prop to `CodeBlock` component. - -By default, the icon will be injected by the custom Shiki transformer. - -```js title="config.js" -console.log('js'); -``` diff --git a/content/docs/mdx/codeblock.zh.mdx b/content/docs/mdx/codeblock.zh.mdx deleted file mode 100644 index 1e9c797..0000000 --- a/content/docs/mdx/codeblock.zh.mdx +++ /dev/null @@ -1,79 +0,0 @@ ---- -title: 代码块 -description: 在文档中添加代码块 ---- - - -
- -```js title="config.js" -import createMDX from 'fumadocs-mdx/config'; - -const withMDX = createMDX(); - -// [!code word:config] -/** @type {import('next').NextConfig} */ -const config = { - // [!code highlight] - reactStrictMode: true, // [!code highlight] -}; // [!code highlight] - -export default withMDX(config); -``` - -
-
- -显示代码块,默认添加。 - -- 复制按钮 -- 自定义标题和图标 - -## 使用方法 - -将 pre 元素包装在 `` 中,它作为代码块的包装器。 - -```tsx -import { Pre, CodeBlock } from 'fumadocs-ui/components/codeblock'; - - ( - -
{props.children}
{/* [!code highlight] */} -
- ), - }} -/>; -``` - -有关用法,请参见 [Markdown](/docs/markdown#codeblock)。 - -### 保留背景 - -使用由 Shiki(Rehype Code 插件)生成的背景颜色。 - -```tsx -import { Pre, CodeBlock } from 'fumadocs-ui/components/codeblock'; - - ( - -
{props.children}
-
- ), - }} -/>; -``` - -### 图标 - -通过向 `CodeBlock` 组件传递 `icon` 属性来指定自定义图标。 - -默认情况下,图标将由自定义 Shiki 转换器注入。 - -```js title="config.js" -console.log('js'); -``` \ No newline at end of file diff --git a/content/docs/mdx/heading.mdx b/content/docs/mdx/heading.mdx deleted file mode 100644 index 2c639f6..0000000 --- a/content/docs/mdx/heading.mdx +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: Heading -description: Heading components for your MDX documentation -preview: heading ---- - -The heading component which automatically adds the `id` prop. - -## Usage - -Add it to your MDX components, from `h1` to `h6`. - -```mdx -import { Heading } from 'fumadocs-ui/components/heading'; - - , - h2: (props) => , - h3: (props) => , - h4: (props) => , - h5: (props) => , - h6: (props) => , - }} -/> -``` diff --git a/content/docs/mdx/heading.zh.mdx b/content/docs/mdx/heading.zh.mdx deleted file mode 100644 index e943b49..0000000 --- a/content/docs/mdx/heading.zh.mdx +++ /dev/null @@ -1,26 +0,0 @@ ---- -title: 标题 -description: MDX 文档的标题组件 -preview: heading ---- - -自动添加 `id` 属性的标题组件。 - -## 使用方法 - -将其添加到您的 MDX 组件中,从 `h1` 到 `h6`。 - -```mdx -import { Heading } from 'fumadocs-ui/components/heading'; - - , - h2: (props) => , - h3: (props) => , - h4: (props) => , - h5: (props) => , - h6: (props) => , - }} -/> -``` \ No newline at end of file diff --git a/content/docs/mdx/index.mdx b/content/docs/mdx/index.mdx deleted file mode 100644 index 65406cc..0000000 --- a/content/docs/mdx/index.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -title: MDX -description: Default MDX Components -index: true ---- - -## Usage - -The default MDX components include Cards, Callouts, Code Blocks and Headings. - -```ts -import defaultMdxComponents from 'fumadocs-ui/mdx'; -``` - -### Relative Link - -To support links with relative file path in `href`, override the default `a` component with: - -```tsx -import { createRelativeLink } from 'fumadocs-ui/mdx'; -import { source } from '@/lib/source'; - -const page = source.getPage(['...']); - -return ( - -); -``` - -```mdx -[My Link](./file.mdx) -``` - -[Example: `../(integrations)/open-graph.mdx`](<../(integrations)/open-graph.mdx>) - -Server Component only. diff --git a/content/docs/mdx/index.zh.mdx b/content/docs/mdx/index.zh.mdx deleted file mode 100644 index c4c5420..0000000 --- a/content/docs/mdx/index.zh.mdx +++ /dev/null @@ -1,41 +0,0 @@ ---- -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 ( - -); -``` - -```mdx -[My Link](./file.mdx) -``` - -[示例: `../(integrations)/open-graph.mdx`](<../(integrations)/open-graph.mdx>) - -仅限服务器组件。 \ No newline at end of file diff --git a/content/docs/meta.json b/content/docs/meta.json index b285220..d509731 100644 --- a/content/docs/meta.json +++ b/content/docs/meta.json @@ -17,9 +17,6 @@ "---UI---", "customisation", "theme", - "search", - "components", - "mdx", - "layouts" + "search" ] } diff --git a/content/docs/meta.zh.json b/content/docs/meta.zh.json index 7172470..e2597f2 100644 --- a/content/docs/meta.zh.json +++ b/content/docs/meta.zh.json @@ -17,9 +17,6 @@ "---UI---", "customisation", "theme", - "search", - "components", - "mdx", - "layouts" + "search" ] }