Skip to main content

Markdown Features

Docusaurus supports Markdown and a few additional features.

Front Matter

Markdown documents have metadata at the top called Front Matter:


_12
// highlight-start
_12
---
_12
id: my-doc-id
_12
title: My document title
_12
description: My document description
_12
slug: /my-custom-url
_12
---
_12
// highlight-end
_12
_12
## Markdown heading
_12
_12
Markdown text with [links](./hello.md)

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


_10
Let's see how to [Create a page](/create-a-page).


_10
Let's see how to [Create a page](./create-a-page.md).

Result: Let's see how to Create a page.

Images

Regular Markdown images are supported.

You can use absolute paths to reference images in the static directory (static/img/docusaurus.png):


_10
![Docusaurus logo](/img/docusaurus.png)

Docusaurus logo

You can reference images relative to the current file as well. This is particularly useful to colocate images close to the Markdown files using them:


_10
![Docusaurus logo](./img/docusaurus.png)

Code Blocks

Markdown code blocks are supported with Syntax highlighting.


_10
function HelloDocusaurus() {
_10
return (
_10
<h1>Hello, Docusaurus!</h1>
_10
)
_10
}


_10
function HelloDocusaurus() {
_10
return <h1>Hello, Docusaurus!</h1>;
_10
}

Admonitions

Docusaurus has a special syntax to create admonitions and callouts:

:::tip My tip

Use this awesome feature option

:::

:::danger Take care

This action is dangerous

:::

:::tip My tip

Use this awesome feature option

:::

:::danger Take care

This action is dangerous

:::

MDX and React Components

MDX can make your documentation more interactive and allows using any React components inside Markdown:


_19
export const Highlight = ({children, color}) => (
_19
<span
_19
style={{
_19
backgroundColor: color,
_19
borderRadius: '20px',
_19
color: '#fff',
_19
padding: '10px',
_19
cursor: 'pointer',
_19
}}
_19
onClick={() => {
_19
alert(`You clicked the color ${color} with label ${children}`)
_19
}}>
_19
{children}
_19
</span>
_19
);
_19
_19
This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !
_19
_19
This is <Highlight color="#1877F2">Facebook blue</Highlight> !

This is Docusaurus green !

This is Facebook blue !