docusaurus/packages/docusaurus-init/templates/classic/docs/markdown-features.mdx
besemuna b99a4031c6
feat(v2): Improve the initial templates #4302 (#4320)
* feat: add getting started doc at classic inital templates

* fix: improve the contents of getting started page

* fix: fix slug routing

* fix: rename gettingStarted to getting-started and re-adjust the content

* feat: add markdown-features docs

* feat: add a page on how to create a simple document

* feat: add a page on how to create pages

* feat: add create a post doc

* feat: add thank you page with whats next

* feat : update sidebar.js

* feat : add introduction content

* feat : add self hosting content

* feat : add GitHub pages content

* fix : remove automatically deploying with github actions content

* feat : add deploying to netlify

* feat : add Translate your site

* add : Manage versions

* fix : formatted docs with prettier

* Revert "fix : formatted docs with prettier"

This reverts commit af8c0b48

* run prettier to init templates with fixes

* complete new init template

* rename manage-docs-versions

* change wording

* refresh config file

* rework init template homepage

* minor changes

Co-authored-by: Lisa Chandra <52909743+lisa761@users.noreply.github.com>
Co-authored-by: Javid <singularity.javid@gmail.com>
Co-authored-by: ShinteiMai <stevenhanselgo@gmail.com>
Co-authored-by: slorber <lorber.sebastien@gmail.com>
2021-03-17 15:59:01 +01:00

140 lines
2.7 KiB
Text

---
title: Markdown Features
---
Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/syntax)** and a few **additional features**.
## Front Matter
Markdown documents have metadata at the very top called [Front Matter](https://jekyllrb.com/docs/front-matter/):
```md
---
id: my-doc
title: My document title
description: My document description
sidebar_label: My doc
---
## Markdown heading
Markdown text with [links](./hello.md)
```
## Links
Regular Markdown links are supported, using url paths or relative file paths.
```md
Let's see how to [Create a page](/create-a-page).
```
```md
Let's see how to [Create a page](./create-a-page.md).
```
**Result:** Let's see how to [Create a page](./create-a-page.md).
## Images
Regular Markdown images are supported.
Add an image at `static/img/docusaurus.png` and display it in Markdown:
```md
![Docusaurus logo](/img/docusaurus.png)
```
![Docusaurus logo](/img/docusaurus.png)
## Code Blocks
Markdown code blocks are supported with Syntax highlighting.
```jsx title="src/components/HelloDocusaurus.js"
function HelloDocusaurus() {
return (
<h1>Hello, Docusaurus!</h1>
)
}
```
```jsx title="src/components/HelloDocusaurus.js"
function HelloDocusaurus() {
return <h1>Hello, Docusaurus!</h1>;
}
```
## 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](https://mdxjs.com/) can make your documentation more **interactive** and allows using any **React components inside Markdown**:
```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> !
```
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> !