跳至內容
Fumadocs

全域選項

自訂 Fumadocs MDX

Fumadocs MDX 的全域選項 (例如所有集合共用的 MDX 外掛) 應寫在專案根目錄的 source.config.ts 中。此檔案並非必要,且可搭配在 lib/source.ts 中透過 Macro API 定義的集合使用。

全域選項

source.config.ts
import { defineConfig } from 'fumadocs-mdx/config';

export default defineConfig({
  // 全域選項
});

屬性

型別

MDX 選項

自訂集合的預設組合。mdxOptions 適用於以 unified 編譯的集合,satteriOptions 則適用於設定 compiler: 'satteri' 的集合。

source.config.ts
import { defineConfig } from 'fumadocs-mdx/config';
import { myPlugin } from './remark-plugin';

export default defineConfig({
  mdxOptions: {
    // 需要控制順序時
    remarkPlugins: (v) => [myPlugin, ...v],
  },
});

或使用 minimal 預設組合:

source.config.ts
import { defineConfig } from 'fumadocs-mdx/config';

export default defineConfig({
  mdxOptions: {
    preset: 'minimal',
    // 現在只接受 MDX 處理器選項
  },
});

How is this guide?

最後更新於