Written by

Fuma Nama

At

Wed Oct 22 2025

Fumadocs v16

更好的框架支持,更高的性能。

Back

概览

🌐 Overview

我们很高兴地宣布发布 Fumadocs v16,这是一次重大更新,带来了破坏性变更,旨在优化我们的 API 接口,提高与 Vite 框架的兼容性,并提升整体性能。

🌐 We are pleased to announce the release of Fumadocs v16, a significant update that introduces breaking changes designed to refine our API surface, improve compatibility with Vite frameworks, and boost overall performance.

重大变化

🌐 Major Changes

Fumadocs 16 移除了自 v15.2 Vite 支持以来积累的大量弃用 API。

🌐 Fumadocs 16 removed substantial amount of deprecated APIs accumulated since v15.2 Vite support.

  • 侧边栏 API 的移除fumadocs-core/sidebar 模块已被弃用并移除。对于侧边栏实现,我们建议采用 Shadcn UI 提供的预制解决方案。

  • 服务器端导出重构:来自 fumadocs-core/server 的导出已重新分配到更专业的模块中:

    • getGithubLastEdit -> fumadocs-core/content/github
    • getTableOfContents -> fumadocs-core/content/toc
    • PageTree 及相关工具 -> fumadocs-core/page-tree
    • TOCItemTypeTableOfContents -> fumadocs-core/toc
    • 已移除 createMetadataImage API,请改用 Next.js 元数据 API。
  • 默认切换到 Shiki 的 JavaScript 正则引擎:为了确保与 Cloudflare Workers 等环境的无缝兼容,现在 JavaScript 引擎已成为默认选项,取代基于 WASM 的 Oniguruma。此更改会影响 rehype-code(通过 engine 选项)和 fumadocs-core/highlight

  • 最低 React.js 版本提升至 19.2.0:React 19.2 为 Fumadocs UI 带来了关键的性能改进。

    • Next.js 项目:使用 Fumadocs UI 的 Next.js 项目必须使用 Next.js 16 或更高版本,因为 Next.js 使用其自己的 React.js 金丝雀通道。
  • fumadocs-ui/provider 已被移除

    • 使用 fumadocs-ui/provider/next 作为根提供程序。
    • 对于来自 fumadocs-ui/contexts/* 的上下文,使用单独导出。
  • fumadocs-ui/page

    • 已移除 <DocsCategory />,请改用 getPageTreePeers()

      page.tsx
      import { getPageTreePeers } from 'fumadocs-core/page-tree';
      import { source } from '@/lib/source';
      
      <Cards>
        {getPageTreePeers(source.getPageTree(), '/docs/my-page').map((peer) => (
          <Card key={peer.url} title={peer.name} href={peer.url}>
            {peer.description}
          </Card>
        ))}
      </Cards>;
    • 已在 <DocsPage /> 中移除 breadcrumbs.full 选项。

  • fumadocs-core/search/algoliadocument 选项已重命名为 indexName

  • fumadocs-core/search:已在useSearch()中移除已弃用的createFromSource()签名。

  • fumadocs-core/highlight:已从 useShiki() 中移除 withPrerenderScriptloading 选项,改用 React Suspense API。

  • fumadocs-core/i18n:已移除 createI18nMiddleware(改为从 fumadocs-core/i18n/middleware 导入)。

  • fumadocs-core/source

    • loader() 中移除了 transformerspageTree.attach* 选项:请改用 Loader 插件
    • 已移除 page.file 属性:请改用 page.path
    • 已移除内部工具 FileInfoparseFilePath:请改用 PathUtils
  • 迁移到 Orama Cloud 的新 SDK@orama/core 包取代了之前的客户端。请按如下方式更新你的同步代码:

    import { sync } from 'fumadocs-core/search/orama-cloud';
    import { OramaCloud } from '@orama/core';
    
    const orama = new OramaCloud({
      projectId: '<project id>',
      apiKey: '<private api key>',
    });
    
    await sync(orama, {
      index: '<data source id>',
      documents: records,
    });

    你也可以继续使用传统的 Orama Cloud 客户端:

    import { ... } from 'fumadocs-core/search/orama-cloud';
    import { ... } from 'fumadocs-core/search/orama-cloud-legacy';
    
    useSearch({
      type: 'orama-cloud',
      type: 'orama-cloud-legacy',
    })

    有关更多详情,请参阅 Orama Cloud 文档

样式更改

🌐 Styling Changes

Fumadocs UI 已经包含了一些你需要了解的激进样式更改。

🌐 Fumadocs UI has included some aggressive styling changes that you should know about.

  • 默认情况下,--fd-layout-width CSS 变量设置为 1600px 以实现最佳内容缩放。如果需要,你可以覆盖它。

    :root {
      --fd-layout-width: 100vw;
    }

Fumadocs 开放API 9.6

🌐 Fumadocs OpenAPI 9.6

重新设计的模式界面强调递归组件的客户端渲染(CSR),从而减少包大小并提升复杂 JSON 模式的性能。

🌐 A redesigned schema UI emphasizes client-side rendering (CSR) for recursive components, reducing bundle sizes and enhancing performance in complex JSON schemas.

Preview

非必填字段现在包含一个重置按钮,并支持 content.showExampleInFields

🌐 Non-required fields now include a reset button, with support for content.showExampleInFields.

接下来是什么?

🌐 What's Next?

Fumadocs v16 是 Fumadocs 的一个全新起点。我们感谢你的反馈和贡献——请在 GitHub 上分享你的使用体验。感谢你对 Fumadocs 的支持 :)

🌐 Fumadocs v16 is a new start for Fumadocs. We appreciate your feedback and contributions—please share your experiences on GitHub. Thank you for supporting Fumadocs :)