Fumadocs

获取目录

从 markdown/mdx 内容解析目录

从 markdown/mdx 内容解析目录。

🌐 Parse Table of contents from markdown/mdx content.

使用

🌐 Usage

注意:如果你正在使用内容管理系统(CMS),应使用该CMS提供的API。

🌐 Note: If you're using a CMS, you should use the API provided by the CMS instead.

import { getTableOfContents } from 'fumadocs-core/content/toc';

const toc = getTableOfContents('## markdown content');

输出

🌐 Output

返回一个 TOCItemType 数组。

🌐 An array of TOCItemType is returned.

Last updated on

On this page