Markdown Features
Only some commonly used Markdown examples are shown here. If you need more, please refer to official document
Front Matter
---
# Unique identifier
id: my-doc-id
# Article Title
title: My document title
# Article description
description: My document description
# File path
slug: /my-custom-url
---
## Markdown heading
Markdown text with [links](./hello.md)
More title page parameter configurations can be referred to plugin-content-pages
Links
Anchor point
- Anchor point
- Preview
External links
Internal links
- Internal links
- Preview
Resources
Picture Zoom
- .mdx file
- .md file
- Preview
<!-- 文章开始引出插件 -->
import Zoom from 'react-medium-image-zoom';
<!-- 文章内容处引入可缩放图片 -->
<Zoom>
![docusaurus](../../static/img/undraw_docusaurus_mountain.svg)
</Zoom>
# 文章开始引出插件
import Zoom from 'react-medium-image-zoom';
# 文章内容处引入可缩放图片
<Zoom>
![docusaurus](undraw_docusaurus_mountain.svg)
</Zoom>
Code Block
Syntax highlighting supports Markdown code blocks
- Highlight code
- Preview
```jsx title="src/components/HelloDocusaurus.js"
function HelloDocusaurus() {
return <h1>Hello, Docusaurus!</h1>;
}
```
function HelloDocusaurus() {
return <h1>Hello, Docusaurus!</h1>;
}
Admonitions
Docusaurus has a special syntax to create warnings and annotations.
- Admonitions
- 预览
# 这里是备注
:::note
This is some note
:::
# 这里是提示
:::tip[My tip]
Use this awesome feature option
:::
# 这里是信息
:::info
This is some info
:::
# 这里是警告
:::warning
This is some warning
:::
# 这里是危险
:::danger[Take care]
This action is dangerous
:::
This is some note
Use this awesome feature option
This is some info
This is some warning
This action is dangerous
Tabs
- Tabs
- Preview
```jsx
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>
```
- Apple
- Orange
- Banana
This is an apple 🍎
This is an orange 🍊
This is a banana 🍌
Fold
- Fold
- Preview
<details>
<summary><code>Fold: </code>This is a foldable title </summary>
Here is the content, supporting Markdown, and the following is a `Tab` tab.
<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>
</details>
Fold:
This is a foldable title
Here is the content, supporting Markdown, and the following is a Tab
tab.
- Apple
- Orange
- Banana
This is an apple 🍎
This is an orange 🍊
This is a banana 🍌
MDX and React Components
MDX It can make your file retention more interactive and allow the use of any React component in Markdown
- MDX React Components
- Preview
```jsx
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 Docusaurus green !
This is Facebook blue !
Mermaid
Flowchart
- Flowchart
- Preview
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
Sequence diagram
- Sequence diagram
- Preview
```mermaid
sequenceDiagram
participant Alice
participant Bob
Alice->>John: Hello John, how are you?
loop HealthCheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts <br/>prevail!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
```
For More Diagrams, Please Refer To Mermaid