mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-06 05:37:16 +02:00
Bias template/tutorial to use .mdx
This commit is contained in:
parent
3adc4ea809
commit
002ea367e7
13 changed files with 18 additions and 18 deletions
|
@ -13,8 +13,8 @@ Regular blog authors can be added to `authors.yml`.
|
||||||
|
|
||||||
The blog post date can be extracted from filenames, such as:
|
The blog post date can be extracted from filenames, such as:
|
||||||
|
|
||||||
- `2019-05-30-welcome.md`
|
- `2019-05-30-welcome.mdx`
|
||||||
- `2019-05-30-welcome/index.md`
|
- `2019-05-30-welcome/index.mdx`
|
||||||
|
|
||||||
A blog post folder can be convenient to co-locate blog post images:
|
A blog post folder can be convenient to co-locate blog post images:
|
||||||
|
|
|
@ -44,4 +44,4 @@ The `cd` command changes the directory you're working with. In order to work wit
|
||||||
|
|
||||||
The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/.
|
The `npm run start` command builds your website locally and serves it through a development server, ready for you to view at http://localhost:3000/.
|
||||||
|
|
||||||
Open `docs/intro.md` (this page) and edit some lines: the site **reloads automatically** and displays your changes.
|
Open `docs/intro.mdx` (this page) and edit some lines: the site **reloads automatically** and displays your changes.
|
|
@ -8,7 +8,7 @@ You have just learned the **basics of Docusaurus** and made some changes to the
|
||||||
|
|
||||||
Docusaurus has **much more to offer**!
|
Docusaurus has **much more to offer**!
|
||||||
|
|
||||||
Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.md)** and **[i18n](../tutorial-extras/translate-your-site.md)**.
|
Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.mdx)** and **[i18n](../tutorial-extras/translate-your-site.mdx)**.
|
||||||
|
|
||||||
Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610)
|
Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610)
|
||||||
|
|
|
@ -8,7 +8,7 @@ Docusaurus creates a **page for each blog post**, but also a **blog index page**
|
||||||
|
|
||||||
## Create your first Post
|
## Create your first Post
|
||||||
|
|
||||||
Create a file at `blog/2021-02-28-greetings.md`:
|
Create a file at `blog/2021-02-28-greetings.mdx`:
|
||||||
|
|
||||||
```md title="blog/2021-02-28-greetings.md"
|
```md title="blog/2021-02-28-greetings.md"
|
||||||
---
|
---
|
|
@ -7,7 +7,7 @@ sidebar_position: 1
|
||||||
Add **Markdown or React** files to `src/pages` to create a **standalone page**:
|
Add **Markdown or React** files to `src/pages` to create a **standalone page**:
|
||||||
|
|
||||||
- `src/pages/index.js` → `localhost:3000/`
|
- `src/pages/index.js` → `localhost:3000/`
|
||||||
- `src/pages/foo.md` → `localhost:3000/foo`
|
- `src/pages/foo.mdx` → `localhost:3000/foo`
|
||||||
- `src/pages/foo/bar.js` → `localhost:3000/foo/bar`
|
- `src/pages/foo/bar.js` → `localhost:3000/foo/bar`
|
||||||
|
|
||||||
## Create your first React Page
|
## Create your first React Page
|
||||||
|
@ -32,9 +32,9 @@ A new page is now available at [http://localhost:3000/my-react-page](http://loca
|
||||||
|
|
||||||
## Create your first Markdown Page
|
## Create your first Markdown Page
|
||||||
|
|
||||||
Create a file at `src/pages/my-markdown-page.md`:
|
Create a file at `src/pages/my-markdown-page.mdx`:
|
||||||
|
|
||||||
```mdx title="src/pages/my-markdown-page.md"
|
```mdx title="src/pages/my-markdown-page.mdx"
|
||||||
# My Markdown page
|
# My Markdown page
|
||||||
|
|
||||||
This is a Markdown page
|
This is a Markdown page
|
|
@ -10,7 +10,7 @@ Docusaurus supports **[Markdown](https://daringfireball.net/projects/markdown/sy
|
||||||
|
|
||||||
Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/):
|
Markdown documents have metadata at the top called [Front Matter](https://jekyllrb.com/docs/front-matter/):
|
||||||
|
|
||||||
```text title="my-doc.md"
|
```text title="my-doc.mdx"
|
||||||
// highlight-start
|
// highlight-start
|
||||||
---
|
---
|
||||||
id: my-doc-id
|
id: my-doc-id
|
||||||
|
@ -22,7 +22,7 @@ slug: /my-custom-url
|
||||||
|
|
||||||
## Markdown heading
|
## Markdown heading
|
||||||
|
|
||||||
Markdown text with [links](./hello.md)
|
Markdown text with [links](./hello.mdx)
|
||||||
```
|
```
|
||||||
|
|
||||||
## Links
|
## Links
|
||||||
|
@ -34,10 +34,10 @@ Let's see how to [Create a page](/create-a-page).
|
||||||
```
|
```
|
||||||
|
|
||||||
```md
|
```md
|
||||||
Let's see how to [Create a page](./create-a-page.md).
|
Let's see how to [Create a page](./create-a-page.mdx).
|
||||||
```
|
```
|
||||||
|
|
||||||
**Result:** Let's see how to [Create a page](./create-a-page.md).
|
**Result:** Let's see how to [Create a page](./create-a-page.mdx).
|
||||||
|
|
||||||
## Images
|
## Images
|
||||||
|
|
||||||
|
|
|
@ -51,5 +51,5 @@ The docs version dropdown appears in your navbar:
|
||||||
|
|
||||||
It is possible to edit versioned docs in their respective folder:
|
It is possible to edit versioned docs in their respective folder:
|
||||||
|
|
||||||
- `versioned_docs/version-1.0/hello.md` updates `http://localhost:3000/docs/hello`
|
- `versioned_docs/version-1.0/hello.mdx` updates `http://localhost:3000/docs/hello`
|
||||||
- `docs/hello.md` updates `http://localhost:3000/docs/next/hello`
|
- `docs/hello.mdx` updates `http://localhost:3000/docs/next/hello`
|
|
@ -4,7 +4,7 @@ sidebar_position: 2
|
||||||
|
|
||||||
# Translate your site
|
# Translate your site
|
||||||
|
|
||||||
Let's translate `docs/intro.md` to French.
|
Let's translate `docs/intro.mdx` to French.
|
||||||
|
|
||||||
## Configure i18n
|
## Configure i18n
|
||||||
|
|
||||||
|
@ -21,15 +21,15 @@ module.exports = {
|
||||||
|
|
||||||
## Translate a doc
|
## Translate a doc
|
||||||
|
|
||||||
Copy the `docs/intro.md` file to the `i18n/fr` folder:
|
Copy the `docs/intro.mdx` file to the `i18n/fr` folder:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/
|
mkdir -p i18n/fr/docusaurus-plugin-content-docs/current/
|
||||||
|
|
||||||
cp docs/intro.md i18n/fr/docusaurus-plugin-content-docs/current/intro.md
|
cp docs/intro.mdx i18n/fr/docusaurus-plugin-content-docs/current/intro.mdx
|
||||||
```
|
```
|
||||||
|
|
||||||
Translate `i18n/fr/docusaurus-plugin-content-docs/current/intro.md` in French.
|
Translate `i18n/fr/docusaurus-plugin-content-docs/current/intro.mdx` in French.
|
||||||
|
|
||||||
## Start your localized site
|
## Start your localized site
|
||||||
|
|
Loading…
Add table
Reference in a new issue