mcpField
F
fumadocs-mdx-structure

fumadocs-mdx-structure

github.com/theorcdev开发2.1k267 次安装2 天前更新
代码仓库

关于 fumadocs-mdx-structure

用于按照既定 Fumadocs 模式编写 8-bit 组件 MDX 文档的技能,规定必需的元数据、导入项、组件预览和章节结构。

主要功能

  1. 01必需的 frontmatter 格式
  2. 02标准导入顺序
  3. 03组件预览规范
  4. 04安装与使用章节
  5. 05组件和区块文件路径

适用场景

  1. 01编写 8-bit 组件文档
  2. 02撰写组件用法示例
  3. 03创建区块文档文件

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/theorcdev/8bitcn-ui --skill fumadocs-mdx-structure

安装后在 Claude Code 中输入/fumadocs-mdx-structure确认已加载。

详细介绍

Fumadocs MDX 结构

按照既定模式,为 8-bit 组件创建结构良好的 MDX 文档文件。

Frontmatter 模式
---
title: Component Name
description: Brief description of the 8-bit component.
---
导入模式

所有文档文件都需要以下导入:

import { ComponentName } from "@/components/ui/8bit/component-name";
import CopyCommandButton from "@/components/copy-command-button";
import InstallationCommands from "@/components/installation-commands";
import ComponentPreview from "@/components/component-preview";
复制命令按钮

放在 frontmatter 后面:

<div className="flex flex-col md:flex-row items-center justify-end gap-2 mb-2">
  <CopyCommandButton
    copyCommand="pnpm dlx shadcn@latest add @8bitcn/component-name"
    command="pnpm dlx shadcn@latest add @8bitcn/component-name"
  />
</div>
组件预览

将组件示例包裹起来:

<ComponentPreview title="8-bit ComponentName component" name="component-name">
  <ComponentName>Example</ComponentName>
</ComponentPreview>
安装部分
## Installation

---

<InstallationCommands packageName="component-name" />
使用部分
## Usage

---

```tsx
import { ComponentName } from "@/components/ui/8bit/component-name"
<ComponentName variant="outline">Example</ComponentName>

### Complete Example

```mdx
---
title: Button
description: Displays an 8-bit button component.
---

import { Button } from "@/components/ui/8bit/button";
import CopyCommandButton from "@/components/copy-command-button";
import InstallationCommands from "@/components/installation-commands";
import ComponentPreview from "@/components/component-preview";

<div className="flex flex-col md:flex-row items-center justify-end gap-2 mb-2">
  <CopyCommandButton
    copyCommand="pnpm dlx shadcn@latest add @8bitcn/button"
    command="pnpm dlx shadcn@latest add @8bitcn/button"
  />
</div>

<ComponentPreview title="8-bit button component" name="button">
  <Button>Button</Button>
</ComponentPreview>

## Installation

---

<InstallationCommands packageName="button" />

## Usage

---

```tsx
import { Button } from "@/components/ui/8bit/button"
<Button variant="outline">Button</Button>

### Key Principles

1. **Frontmatter required** - title and description are mandatory
2. **Import order** - Component → utilities → UI components
3. **Copy button** - Place before ComponentPreview
4. **ComponentPreview** - Use for all component examples
5. **Code blocks** - Use ```tsx for TypeScript examples
6. **Section separators** - Use `---` after headings
7. **8-bit imports** - Use `@/components/ui/8bit/` path

### File Location

Place documentation files in:
- `content/docs/components/component-name.mdx` for components
- `content/docs/blocks/category/block-name.mdx` for blocks

评论

支持 Markdown