Getting Started
Learn how to use Fumadocs MDX in your documentation
Introduction
fumadocs-mdx
is the official content source of Fumadocs. It parses frontmatter and is bundled with many MDX
plugins for building a good documentation site.
This package must be used with Fumadocs
Usage
Install Dependencies
Configuration
Add the plugin to your next.config.mjs
file.
It generates a .map.ts
file once you start the dev server or start building the app.
The map file contains all parsed files, you should add it to .gitignore
.
The Next.js config must be a .mjs
file since Fumadocs is ESM-only.
Define MDX Components
Create mdx-components.tsx
in your root directory.
Resolve Files
To integrate with Fumadocs, create:
For more customisation options, check Source API.
Start Server
A .map.ts
file should be created. You can log and see if it is loaded correctly.
See Pages Conventions to learn how to organize your pages.
Built-in Properties
Property | Description |
---|---|
frontmatter | Frontmatter |
toc | Table of Contents |
structuredData | Structured Data, useful for implementing search |
MDX Plugins
You can customise the options passed to the MDX processor.
Deep Dive
Fumadocs MDX is a webpack plugin over Next.js to support reading/importing a MDX file by its name. Because Next.js could only optimize static imports, it first generates a map file that imports all supported files under the root directory.
The imported files form an array called map
in your .map.ts
file, so that your Next.js app can access them.
Export Properties from vfile.data
The built-in configuration applies a remark plugin that turns vfile.data
properties into exports, you can define additional properties to be exported.
Last updated on