Copypasta to help edit this site
Frontmatterβ
Full example with everything you'll ever need:
sidebar_label: Home
sidebar_class_name: hidden
sidebar_position: 1
title: "Home"
hide_title: true
hide_table_of_contents: true
pagination_next: null
pagination_prev: null
slug: /foo/bar
Mathβ
This is the resource for all LaTeX things.
Used KaTeX, here's a reference. Not sure how do to macros. You can inline between two $ like or you can make them blocks.
- Markup
- Result
$$
P(x) = \frac{1}{\sigma \sqrt{2\pi}} e^{-\frac{(x - \mu)^2}{2\sigma^2}}
$$
If you use just one $, the equation will be aligned left. Here's the Binomial Distribution:
- Markup
- Result
$
y = \frac{n!}{k!(n-k)!}p^k q^{n-k} = \binom{n}{k}p^k q^{n-k}
$
Neato.
Pagesβ
Pages do not have sidebars, only "docs" do.
import React from 'react';
import Layout from '@theme/Layout';
export default function Page() {
return (
<Layout>
<h1>My React page</h1>
<p>This is a React page</p>
</Layout>
);
}
A new page is now available at http://localhost:3000/my-react-page.
Codeβ
Giant example with title, line numbers, line highlights, etc
- Markup
- Result
```tsx title="src/pages/my-react-page.tsx" showLineNumbers {6-9}
import React from 'react';
import Layout from '@theme/Layout';
export default function Page() {
return (
<Layout>
<h1>My React page</h1>
<p>This is a React page</p>
</Layout>
);
}
```
import React from 'react';
import Layout from '@theme/Layout';
export default function Page() {
return (
<Layout>
<h1>My React page</h1>
<p>This is a React page</p>
</Layout>
);
}
You can also use // highlight-start and // highlight-end (with the comment syntax appropriate for your language) too.
Imagesβ
They either refer to stuff in static or can be relative. Use the latter to neatly colocate images pertinent to your document. Easy-peasy.


Linking Internallyβ
Easier to link directly to a Markdown or other file. These will be resolved during build.
This is [a link to an internal document](../docs/foo/bar.md)
Tabsβ
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs>
<TabItem value="apple" label="Apple" default>
This is an apple π
</TabItem>
<TabItem value="orange" label="Orange">
This is an orange π
</TabItem>
<TabItem value="banana" label="Banana">
This is a banana π
</TabItem>
</Tabs>
Admonitionsβ
There are note tip info warning and danger. For example,
:::note
Some **content** with _Markdown_ `syntax`. Check [this `api`](#).
:::
This is what they look like:
Some content with Markdown syntax. Check this api.
Some content with Markdown syntax. Check this api.
Some content with Markdown syntax. Check this api.
Some content with Markdown syntax. Check this api.
Some content with Markdown syntax. Check this api.
MDX and Interactionβ
You can totally use MDX for all sorts of client-side shenanigans.
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="#25c2a0">Docusaurus green</Highlight> !
This is <Highlight color="#1877F2">Facebook blue</Highlight> !
This is Green! and this is Blue.
Badgesβ
- Markup
- Result
import Badge from "@site/components/Badge"
<Badge color="primary">Primary</Badge>
<Badge color="secondary">Secondary</Badge>
<Badge color="success">Success</Badge>
<Badge color="info">Info</Badge>
<Badge color="warning">Warning</Badge>
<Badge color="danger">Danger</Badge>
Mermaidβ
Here's a flowchart reference.