Written by
Fuma Nama
At
Thu Oct 23 2025
Fumadocs MDX v13
更好的跨框架兼容性和灵活性。
概览
🌐 Overview
Fumadocs MDX 精炼了其 API 接口,以实现更好的跨框架兼容性和灵活性。
🌐 Fumadocs MDX refined its API surface for better cross-framework compatibility and flexibility.
插件 API
🌐 Plugins API
我们引入了插件 API,使得可以在不依赖特定打包工具代码的情况下,对 MDX 配置进行可扩展的修改——非常适合文件生成(例如类型、索引)或配置修改。
🌐 We introduced Plugins API, enabling extensible modifications to MDX configurations without bundler-specific code—ideal for file generation (e.g., types, indexes) or config alterations.
Fumadocs MDX 原生提供了一个 json-schema 插件。
🌐 There's a json-schema plugin natively provided by Fumadocs MDX.
import jsonSchema from 'fumadocs-mdx/plugins/json-schema';
import { defineConfig, defineDocs } from 'fumadocs-mdx/config';
export const docs = defineDocs({
dir: 'content/docs',
});
export default defineConfig({
plugins: [jsonSchema()],
});迁移
🌐 Migration
Next.js
createMDXSource 和 resolveFiles 现在已搬迁到 fumadocs-mdx/runtime/next。
这不应该影响大多数项目,因为 docs.toFumadocsSource() 现在是推荐的方式。
🌐 This should not affect majority of projects, as docs.toFumadocsSource() is now the preferred way.
Vite
source.generated.ts 文件已移动到 .source/index.ts,建议你导入 .source 文件夹(使用路径别名)。
🌐 The source.generated.ts file is now moved to .source/index.ts, you are recommended to import the .source folder (with a path alias).
{
"compilerOptions": {
"paths": {
"@/.source": [".source"]
}
}
}迁移:
- 运行开发服务器/typegen 来生成一个
.source文件夹。 - 将其导入到原始的
source.generated.ts上。 - 请注意,docs 和
create-fumadocs-app都已更新到.source文件夹。
我们还支持针对像 Bun/Node.js 这样的其他运行时生成索引文件。
🌐 We also supported index file generation targeting other runtimes like Bun/Node.js.
import { defineConfig } from 'vite';
import mdx from 'fumadocs-mdx/vite';
import * as MdxConfig from './source.config';
export default defineConfig({
plugins: [
mdx(MdxConfig, {
generateIndexFile: {
runtime: 'node',
},
}),
// ...
],
});错误修复
🌐 Bug Fixes
remark-include:修复 Markdown 字符串化逻辑。postprocess.includeMDAST支持。- (Vite) 在客户端加载器上支持
useContent以避免 lint 问题。