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:

my-doc.md
---
id: my-doc-id
title: My document title
description: My document description
slug: /my-custom-url
---

## Markdown heading

Markdown text with [links](./hello.md)

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

Let's see how to [Create a page](/create-a-page).
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):

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

Docusaurus logo

You can reference images relative to the current file as well, as shown in Manage docs versions.

If you want to set a specific size for an image then you can use an HTML image tag and import the image inline with require.

<img src={require("/img/docusaurus.png").default} alt="Docusaurus logo" width="100"/>
Docusaurus logo

Code Blocks​

Markdown code blocks are supported with Syntax highlighting.

src/components/HelloDocusaurus.js
function HelloDocusaurus() {
return (
<h1>Hello, Docusaurus!</h1>
)
}
src/components/HelloDocusaurus.js
function HelloDocusaurus() {
return <h1>Hello, Docusaurus!</h1>;
}

Arrows​

ArrowMarkdown
Up arrow (↑)&uarr;
Down arrow (↓)&darr;
Left arrow (←)&larr;
Right arrow (→)&rarr;
Double headed arrow (↔)&harr;

Admonitions​

Docusaurus has a special syntax to create admonitions and callouts:

My tip

Use this awesome feature option

:::

Take care

This action is dangerous

My tip

Use this awesome feature option

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:

export const Highlight = ({children, color}) => (
<span
style={{
backgroundColor: color,
borderRadius: '20px',
color: '#fff',
padding: '10px',
cursor: 'pointer',
}}
onClick={() => {
alert(`You clicked the color ${color} with label ${children}`)
}}>
{children}
</span>
);

This is <Highlight color="#f7d849">5app yellow</Highlight> !

This is <Highlight color="#369F85">5app teal</Highlight> !

This is 5app yellow !

This is 5app teal !

Mermaid Diagrams​

Add a code block with language mermaid.

Example Mermaid diagram:

```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```;

Flowchart​

```mermaid
flowchart TD
A[Start] --> B{Is it?}
B -- Yes --> C[OK]
C --> D[Rethink]
D --> B
B -- No ----> E[End]
```;

Sequence diagrams​

```mermaid
sequenceDiagram
Rob->>Andrew: Hello Andrew, how are you?
Andrew-->>Rob: Great!
Rob-)Andrew: See you later!
```;

Gitgraph Diagram​

```mermaid
gitGraph
commit
commit
branch develop
checkout develop
commit
commit
checkout main
merge develop
commit
```;

Entity Relationship Diagram​

```mermaid
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
```;

See the Mermaid syntax documentation for more information on the Mermaid syntax and further diagram styles.