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---_12id: my-doc-id_12title: My document title_12description: My document description_12slug: /my-custom-url_12---_12// highlight-end_12_12## Markdown heading_12_12Markdown text with [links](./hello.md)
Links
Regular Markdown links are supported, using url paths or relative file paths.
_10Let's see how to [Create a page](/create-a-page).
_10Let'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)
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.
_10function HelloDocusaurus() {_10 return (_10 <h1>Hello, Docusaurus!</h1>_10 )_10}
_10function 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:
_19export 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_19This is <Highlight color="#25c2a0">Docusaurus green</Highlight> !_19_19This is <Highlight color="#1877F2">Facebook blue</Highlight> !
This is Docusaurus green !
This is Facebook blue !