Fumadocs rebuilt on Hamur, the original is fumadocs.dev
Skip to Content
Fumadocs

Markdown

The Markdown syntax of Fumadocs pages.

Pages are written in MDX, Markdown with JSX, and support GitHub Flavored Markdown like tables and autolinks.

import { Chart } from '@/components/chart';

Read the [guide](/docs/guide), or visit https://github.com.

<Chart data={[1, 2, 3]} />

External links open in a new tab, while internal links use the Link component of your framework.

Frontmatter

The docs page renders title and description as its header, so the content starts without a # Heading.

---
title: Deploy
description: Deploy your site.
---

## Requirements

An MDX page can also export its frontmatter in code. The export is merged over the YAML frontmatter, and can read props:

---
title: Deploy
---

export const frontmatter = {
  description: `Deploy your ${props.framework} site.`,
};

To add frontmatter properties, give the content collection a schema that extends pageSchema from fumadocs-core/source/schema.

Headings

Each heading gets an ID from its text, for links like /docs/page#hello-world.

## Hello World

<!-- a custom ID: #install -->

## Installation [#install]

<!-- hidden from the table of contents -->

## Changelog [!toc]

<!-- only in the table of contents, for a heading rendered by a component -->

## API Reference [toc]

Code Blocks

Code blocks are highlighted with Shiki.

```js title="config.js" lineNumbers
console.log('Hello World');
```
config.js
console.log('Hello World');

lineNumbers=4 starts the line numbers from 4, and noCopy hides the copy button.

Highlighting Lines

Mark lines with comments, which are removed from the output:

```tsx
<div>Hello World</div> // [!code highlight]

// [!code word:Fumadocs]
<div>Fumadocs</div>

console.log('hewwo'); // [!code --]
console.log('hello'); // [!code ++]

return new ResizeObserver(() => {}) // [!code focus]
```

These are the notations of Shiki Transformers.

Tab Groups

Adjacent code blocks with a tab form a tab group:

```ts tab="Tab 1"
console.log('A');
```

```ts tab="Tab 2"
console.log('B');
```
console.log('A');

Tab groups with the same tab-group on their first code block switch together, and remember the selected tab across visits:

```bash tab="npm" tab-group="package-manager"
npm i fumadocs-core
```

```bash tab="pnpm"
pnpm add fumadocs-core
```
npm i fumadocs-core

To write MDX in tab names, enable parseMdx:

astro.config.mjs
import { defineConfig } from 'astro/config';
import fumadocs from '@fumadocs/astro';

export default defineConfig({
  integrations: [
    fumadocs({
      remarkCodeTabOptions: {
        parseMdx: true,
      },
    }),
  ],
});
```ts tab="<Building /> Tab 1"
console.log('A');
```

```ts tab="<Rocket /> Tab 2"
console.log('B');
```
console.log('A');

Install Commands

An npm code block becomes a tab group of package managers:

```npm
npm i next -D
```
npm i next -D

Components

These components are available in MDX by default. See Components for more, like tabs and accordions.

Callouts

{/* type: info (default), warn, error, success or idea */}

<Callout>Hello World</Callout>

<Callout title="Title" type="warn">
  Hello World
</Callout>
Hello World

Title

Hello World

Cards

import { HomeIcon } from 'lucide-react';

<Cards>
  <Card href="/docs" title="Documentation">
    Browse the full documentation.
  </Card>
  <Card icon={<HomeIcon />} href="/" title="Home">
    Cards can have icons.
  </Card>
  <Card title="Plain Card">Without `href`, a card is not a link.</Card>
</Cards>

Steps

After enabling Remark Steps, headings with [step] become numbered steps:

### Install [step]

### Write Code [step]

### Deploy [step]

Install

Write Code

Deploy

Include

<include> embeds another file, with a path relative to the current file:

page.mdx
<include>./shared/requirements.mdx</include>

It can also embed code files and sections of a document, see Include.

Props

A page receives its path params as props, like framework for a page in a [framework] folder:

[framework]/deploy.mdx
{/* the ID is `deploy-on-astro` on the Astro page */}

## Deploy on {props.framework}

Deploy your {props.framework} site.

The table of contents, the search index and the Markdown for LLMs get the rendered text too. You can also pass custom props to a page.

Show

<show> renders its content when the when expression is true:

[framework]/deploy.mdx
### Build [step]

<show when={props.framework === 'astro'}>

### Add an Adapter [step]

Add an adapter to your Astro config.

</show>

{/* step 3 on the Astro page, step 2 on the others */}

### Deploy [step]

Content that isn't rendered is also left out of the table of contents, the search index and the Markdown for LLMs. A code block of a tab group works the same way: its tab only appears when the code block is rendered.

How is this guide?

Last updated on