Fumadocs

Remark Heading

Process headings from your document

Usage

It extracts the headings (table of contents) of a document to vfile.data.toc. You may write your own plugin to convert it into a MDX export.

import { remarkHeading } from 'fumadocs-core/mdx-plugins';
 
export default {
  remarkPlugins: [remarkHeading],
};

If your heading doesn't have an id, it will add one automatically.

Custom Ids

You can customise the heading id with [#slug].

# heading [#slug]

Output

An array of TOCItemType.

PropTypeDefault
title
ReactNode
-
url
string
-
depth
number
-

Last updated on

On this page

Edit on GitHub