Fumadocs MDX v12

Runtime improvements & LLM integrations.

Back

Overview

Fumadocs MDX v12 mainly aims to unify Fumadocs MDX on Vite and Next.js.

It contains renames to certain APIs (import paths are unaffected), migrations may be necessary.

Breaking Changes

Next.js

Removed content on page data in favour of getText().

import { source } from '@/lib/source';

const page = source.getPage(['...']);
console.log(page.data.content);

API Renames on page data:

  • _file -> info.
  • _file.absolutePath -> info.fullPath.
import { source } from '@/lib/source';

const page = source.getPage(['...']);
console.log(page._file, page._file.absolutePath);

Improvements

Vite

Added APIs for info to access raw file info.

import { source } from '@/lib/source';

const page = source.getPage(['...']);
console.log(page.info);

getText()

You can use it to access:

  • Raw Markdown content.
  • Processed Markdown before being compiled into HAST (HTML).

This is useful for llms.txt generation when used with docs generations tools & remark plugins.

import { source } from '@/lib/source';

const page = source.getPage(['...']);
console.log(await page.data.getText('raw'));
console.log(await page.data.getText('processed'));

To access processed Markdown content, you need to enable includeProcessedMarkdown in collection config.

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

export default defineDocs({
  docs: {
    postprocess: {
      includeProcessedMarkdown: true,
    },
  },
});

Written by

Fuma Nama

At

Sat Sep 20 2025