Skip to content

Commit 00a8162

Browse files
authored
feat(create-docusaurus): update init template to .mdx extension and strict MDX syntax (#11897)
1 parent c6efc14 commit 00a8162

13 files changed

Lines changed: 29 additions & 13 deletions

File tree

packages/create-docusaurus/templates/shared/blog/2019-05-28-first-blog-post.md renamed to packages/create-docusaurus/templates/shared/blog/2019-05-28-first-blog-post.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ tags: [hola, docusaurus]
77

88
Lorem ipsum dolor sit amet...
99

10-
<!-- truncate -->
10+
{/* truncate */}
1111

1212
...consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet

packages/create-docusaurus/templates/shared/blog/2019-05-29-long-blog-post.md renamed to packages/create-docusaurus/templates/shared/blog/2019-05-29-long-blog-post.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ tags: [hello, docusaurus]
77

88
This is the summary of a very long blog post,
99

10-
Use a `<!--` `truncate` `-->` comment to limit blog post size in the list view.
10+
Use a `{/*` `truncate` `*/}` comment to limit blog post size in the list view.
1111

12-
<!-- truncate -->
12+
{/* truncate */}
1313

1414
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque elementum dignissim ultricies. Fusce rhoncus ipsum tempor eros aliquam consequat. Lorem ipsum dolor sit amet
1515

packages/create-docusaurus/templates/shared/blog/2021-08-26-welcome/index.md renamed to packages/create-docusaurus/templates/shared/blog/2021-08-26-welcome/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ tags: [facebook, hello, docusaurus]
99

1010
Here are a few tips you might find useful.
1111

12-
<!-- truncate -->
12+
{/* truncate */}
1313

1414
Simply add Markdown files (or folders) to the `blog` directory.
1515

packages/create-docusaurus/templates/shared/docs/intro.md renamed to packages/create-docusaurus/templates/shared/docs/intro.mdx

File renamed without changes.

packages/create-docusaurus/templates/shared/docs/tutorial-basics/congratulations.md renamed to packages/create-docusaurus/templates/shared/docs/tutorial-basics/congratulations.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ You have just learned the **basics of Docusaurus** and made some changes to the
88

99
Docusaurus has **much more to offer**!
1010

11-
Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.md)** and **[i18n](../tutorial-extras/translate-your-site.md)**.
11+
Have **5 more minutes**? Take a look at **[versioning](../tutorial-extras/manage-docs-versions.mdx)** and **[i18n](../tutorial-extras/translate-your-site.mdx)**.
1212

1313
Anything **unclear** or **buggy** in this tutorial? [Please report it!](https://github.com/facebook/docusaurus/discussions/4610)
1414

packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-blog-post.md renamed to packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-blog-post.mdx

File renamed without changes.

packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-document.md renamed to packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-document.mdx

File renamed without changes.

packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-page.md renamed to packages/create-docusaurus/templates/shared/docs/tutorial-basics/create-a-page.mdx

File renamed without changes.

packages/create-docusaurus/templates/shared/docs/tutorial-basics/deploy-your-site.md renamed to packages/create-docusaurus/templates/shared/docs/tutorial-basics/deploy-your-site.mdx

File renamed without changes.

packages/create-docusaurus/templates/shared/docs/tutorial-basics/markdown-features.mdx

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,25 @@ slug: /my-custom-url
2020
---
2121
// highlight-end
2222
23-
## Markdown heading
23+
Markdown content
24+
```
25+
26+
## Headings {/* #my-heading-id */}
27+
28+
Markdown headings are supported using the standard “#” syntax and are automatically added to the table of contents. The number of `#` corresponds to the heading level.
29+
30+
```md
31+
## Headings
2432

25-
Markdown text with [links](./hello.md)
33+
My text
34+
```
35+
36+
### Heading Ids {/* #my-custom-id */}
37+
38+
Add `{/* #my-custom-id */}` after the heading text to assign it an explicit anchor id, used for linking.
39+
40+
```md
41+
### Heading Ids {/_ #my-custom-id _/}
2642
```
2743

2844
## Links
@@ -34,10 +50,10 @@ Let's see how to [Create a page](/create-a-page).
3450
```
3551

3652
```md
37-
Let's see how to [Create a page](./create-a-page.md).
53+
Let's see how to [Create a page](./create-a-page.mdx).
3854
```
3955

40-
**Result:** Let's see how to [Create a page](./create-a-page.md).
56+
**Result:** Let's see how to [Create a page](./create-a-page.mdx).
4157

4258
## Images
4359

@@ -80,26 +96,26 @@ function HelloDocusaurus() {
8096
Docusaurus has a special syntax to create admonitions and callouts:
8197

8298
```md
83-
:::tip My tip
99+
:::tip[My tip]
84100

85101
Use this awesome feature option
86102

87103
:::
88104

89-
:::danger Take care
105+
:::danger[Take care]
90106

91107
This action is dangerous
92108

93109
:::
94110
```
95111

96-
:::tip My tip
112+
:::tip[My tip]
97113

98114
Use this awesome feature option
99115

100116
:::
101117

102-
:::danger Take care
118+
:::danger[Take care]
103119

104120
This action is dangerous
105121

0 commit comments

Comments
 (0)