Skip to main content

Markdown Features

Docusaurus supports the Markdown syntax and has some additional features.

Front Matter

Markdown documents can have associated metadata at the top called Front Matter:

---
id: my-doc
title: My document title
description: My document description
sidebar_label: My doc
---

Markdown content

Regular Markdown links are supported using url paths or relative file paths.

Let's see how to [Create a page](#).
Let's see how to [Create a page](./markdown-features).

Code blocks

Docusaurus supports GFM (GitHub Flavored Markdown) syntax for code blocks.

Language-specific code blocks

```jsx
function Clock({time}) {
return <h1>{time}</h1>
}
```
```python
def hello():
print("Hello, World!")
```

Line highlighting

```jsx {2,4-6}
function Clock({time}) {
return <h1>{time}</h1> // highlight this line
}
```

Interactive code blocks

```jsx live
function Clock() {
const [time, setTime] = useState(new Date().toLocaleTimeString());
useEffect(() => {
const timer = setInterval(() => setTime(new Date().toLocaleTimeString()), 1000);
return () => clearInterval(timer);
}, []);
return <h1>{time}</h1>;
}
```

Admonitions

Docusaurus has a special syntax to create admonitions:

:::note
This is a note
:::
:::tip
This is a tip
:::
:::info
This is an info
:::
:::caution
This is a caution
:::
:::danger
This is a danger
:::

Tables

Markdown tables are supported:

Header 1Header 2Header 3
Row 1, Col 1Row 1, Col 2Row 1, Col 3
Row 2, Col 1Row 2, Col 2Row 2, Col 3

Lists

Docusaurus supports ordered and unordered lists:

Unordered lists

  • Item 1
  • Item 2
    • Nested item 1
    • Nested item 2

Ordered lists

  1. First item
  2. Second item
    1. Nested item 1
    2. Nested item 2