diff --git a/website/docs/blog.mdx b/website/docs/blog.mdx index 26ef286377..b215ae66a2 100644 --- a/website/docs/blog.mdx +++ b/website/docs/blog.mdx @@ -192,9 +192,10 @@ Use the `authors` front matter field to declare blog post authors. An author sho Blog post authors can be declared directly inside the front matter: -````mdx-code-block +```mdx-code-block - + +``` ```md title="my-blog-post.md" --- @@ -207,8 +208,10 @@ authors: --- ``` - - +```mdx-code-block + + +``` ```md title="my-blog-post.md" --- @@ -225,9 +228,10 @@ authors: --- ``` - +```mdx-code-block + -```` +``` :::tip @@ -279,9 +283,10 @@ Use the `authorsMapPath` plugin option to configure the path. JSON is also suppo In blog posts front matter, you can reference the authors declared in the global configuration file: -````mdx-code-block +```mdx-code-block - + +``` ```md title="my-blog-post.md" --- @@ -289,8 +294,10 @@ authors: jmarcey --- ``` - - +```mdx-code-block + + +``` ```md title="my-blog-post.md" --- @@ -298,9 +305,10 @@ authors: [jmarcey, slorber] --- ``` - +```mdx-code-block + -```` +``` :::info @@ -394,9 +402,10 @@ The default reading time is able to accept additional options: `wordsPerMinute` Use the callback for all your customization needs: -````mdx-code-block +```mdx-code-block +``` **Disable reading time on one page:** @@ -410,7 +419,9 @@ module.exports = { showReadingTime: true, // highlight-start readingTime: ({content, frontMatter, defaultReadingTime}) => - frontMatter.hide_reading_time ? undefined : defaultReadingTime({content}), + frontMatter.hide_reading_time + ? undefined + : defaultReadingTime({content}), // highlight-end }, }, @@ -429,8 +440,10 @@ hide_reading_time: true This page will no longer display the reading time stats! ``` +```mdx-code-block +``` **Pass options to the default reading time function:** @@ -452,8 +465,10 @@ module.exports = { }; ``` +```mdx-code-block +``` **Use a custom implementation of reading time:** @@ -475,9 +490,10 @@ module.exports = { }; ``` +```mdx-code-block -```` +``` ::: diff --git a/website/docs/deployment.mdx b/website/docs/deployment.mdx index ded6aca33f..d537b7b48d 100644 --- a/website/docs/deployment.mdx +++ b/website/docs/deployment.mdx @@ -302,31 +302,37 @@ GitHub enterprise installations should work in the same manner as github.com; yo Finally, to deploy your site to GitHub Pages, run: -````mdx-code-block +```mdx-code-block +``` ```bash GIT_USER= yarn deploy ``` +```mdx-code-block +``` ```batch cmd /C "set "GIT_USER=" && yarn deploy" ``` +````mdx-code-block +```mdx-code-block ```powershell cmd /C 'set "GIT_USER=" && yarn deploy' -``` +```` +```mdx-code-block -```` +``` :::caution @@ -352,16 +358,16 @@ Here are two approaches to deploying your docs with GitHub Actions. Based on the - Source repo and deployment repo are the **same** repository. - The deployment repo is a **remote** repository, different from the source. -````mdx-code-block +```mdx-code-block +``` While you can have both jobs defined in the same workflow file, the original `deploy` workflow will always be listed as skipped in the PR check suite status, which is not communicative of the actual status and provides no value to the review process. We therefore propose to manage them as separate workflows instead. We will use a popular third-party deployment action: [peaceiris/actions-gh-pages](https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus).
- GitHub action files Add these two workflow files: @@ -446,8 +452,10 @@ jobs:
+```mdx-code-block
+``` A cross-repo publish is more difficult to set up, because you need to push to another repo with permission checks. We will be using SSH to do the authentication. @@ -517,9 +525,10 @@ jobs: +```mdx-code-block
-```` +``` ### Triggering deployment with Travis CI {#triggering-deployment-with-travis-ci} diff --git a/website/docs/guides/markdown-features/markdown-features-admonitions.mdx b/website/docs/guides/markdown-features/markdown-features-admonitions.mdx index a864fe0d4f..53858f86d0 100644 --- a/website/docs/guides/markdown-features/markdown-features-admonitions.mdx +++ b/website/docs/guides/markdown-features/markdown-features-admonitions.mdx @@ -47,6 +47,7 @@ Some **content** with _markdown_ `syntax`. Check [this `api`](#). ::: ``` +```mdx-code-block :::note @@ -80,6 +81,7 @@ Some **content** with _markdown_ `syntax`. Check [this `api`](#). ::: +``` ## Usage with Prettier {#usage-with-prettier} @@ -115,6 +117,7 @@ Some **content** with _markdown_ `syntax`. ::: ``` +```mdx-code-block :::note Your Title @@ -124,6 +127,7 @@ Some **content** with _markdown_ `syntax`. ::: +``` ## Admonitions with MDX {#admonitions-with-mdx} @@ -145,21 +149,21 @@ import TabItem from '@theme/TabItem'; ::: ``` +```mdx-code-block :::tip Use tabs in admonitions -```mdx-code-block This is an apple 🍎 This is an orange 🍊 This is a banana 🍌 -``` ::: +``` ## Usage in JSX {#usage-in-jsx} @@ -190,6 +194,7 @@ The types that are accepted are the same as above: `note`, `tip`, `danger`, `inf ``` +```mdx-code-block

@@ -198,3 +203,4 @@ The types that are accepted are the same as above: `note`, `tip`, `danger`, `inf

+``` diff --git a/website/docs/guides/markdown-features/markdown-features-code-blocks.mdx b/website/docs/guides/markdown-features/markdown-features-code-blocks.mdx index 3661393dea..2eaaf21837 100644 --- a/website/docs/guides/markdown-features/markdown-features-code-blocks.mdx +++ b/website/docs/guides/markdown-features/markdown-features-code-blocks.mdx @@ -161,8 +161,9 @@ function HighlightMoreText(highlight) { ``` ```` -````mdx-code-block +```mdx-code-block +``` ```js function HighlightSomeText(highlight) { @@ -185,8 +186,9 @@ function HighlightMoreText(highlight) { } ``` +```mdx-code-block -```` +``` Supported commenting syntax: @@ -235,8 +237,9 @@ export default MyComponent; ``` ```` -````mdx-code-block +```mdx-code-block +``` ```jsx {1,4-6,11} import React from 'react'; @@ -252,8 +255,9 @@ function MyComponent(props) { export default MyComponent; ``` +```mdx-code-block -```` +``` :::tip prefer comments @@ -347,8 +351,9 @@ console.log(name.toUpperCase()); ``` -````mdx-code-block +```mdx-code-block +``` In JavaScript, trying to access properties on `null` will error. @@ -359,8 +364,9 @@ console.log(name.toUpperCase()); // Uncaught TypeError: Cannot read properties of null (reading 'toUpperCase') ``` +```mdx-code-block -```` +``` If you use number ranges in metastring (the `{1,3-4}` syntax), Docusaurus will apply the **first `magicComments` entry**'s class name. This, by default, is `theme-code-block-highlighted-line`, but if you change the `magicComments` config and use a different entry as the first one, the meaning of the metastring range will change as well. @@ -396,8 +402,9 @@ export default MyComponent; ``` ```` -````mdx-code-block +```mdx-code-block +``` ```jsx {1,4-6,11} showLineNumbers import React from 'react'; @@ -413,8 +420,9 @@ function MyComponent(props) { export default MyComponent; ``` +```mdx-code-block -```` +``` ## Interactive code editor {#interactive-code-editor} @@ -465,8 +473,9 @@ function Clock(props) { The code block will be rendered as an interactive editor. Changes to the code will reflect on the result panel live. -````mdx-code-block +```mdx-code-block +``` ```jsx live function Clock(props) { @@ -491,8 +500,9 @@ function Clock(props) { } ``` +```mdx-code-block -```` +``` ### Imports {#imports} @@ -541,8 +551,9 @@ export default ReactLiveScope; The `ButtonExample` component is now available to use: -````mdx-code-block +```mdx-code-block +``` ```jsx live function MyPlayground(props) { @@ -554,8 +565,9 @@ function MyPlayground(props) { } ``` +```mdx-code-block -```` +``` ## Using JSX markup in code blocks {#using-jsx-markup} @@ -646,10 +658,11 @@ class HelloWorld { And you will get the following: -````mdx-code-block +```mdx-code-block +``` ```js function helloWorld() { @@ -657,16 +670,20 @@ function helloWorld() { } ``` +```mdx-code-block +``` ```py def hello_world(): print("Hello, world!") ``` +```mdx-code-block +``` ```java class HelloWorld { @@ -676,10 +693,11 @@ class HelloWorld { } ``` +```mdx-code-block -```` +``` If you have multiple of these multi-language code tabs, and you want to sync the selection across the tab instances, refer to the [Syncing tab choices section](markdown-features-tabs.mdx#syncing-tab-choices). diff --git a/website/docs/guides/markdown-features/markdown-features-react.mdx b/website/docs/guides/markdown-features/markdown-features-react.mdx index 0a3e31ba6d..47f2e6046d 100644 --- a/website/docs/guides/markdown-features/markdown-features-react.mdx +++ b/website/docs/guides/markdown-features/markdown-features-react.mdx @@ -204,21 +204,22 @@ We use lower-case tag names like `highlight` to "pretend" that they are intrinsi Docusaurus v2 is using MDX v1, which has a lot of known cases where the content fails to be correctly parsed as Markdown. Use the **[MDX playground](https://mdx-git-renovate-babel-monorepo-mdx.vercel.app/playground)** to ensure that your syntax is valid MDX. -````mdx-code-block
- Samples of parsing failures **A paragraph starting with a JSX tag will be seen entirely as a JSX string:** +```mdx-code-block
+``` ```jsx Highlighted text but afterwards _Markdown_ **doesn't work** ``` +```mdx-code-block
@@ -233,6 +234,7 @@ Docusaurus v2 is using MDX v1, which has a lot of known cases where the content Use JSX for the rest of the line, or prefix the line with some plain text:
+``` ```jsx Use JSX for the paragraph to stop worrying about Markdown @@ -240,6 +242,7 @@ Use JSX for the rest of the line, or prefix the line with some plain text: ​← This is a zero-width space and afterwards Markdown works ``` +```mdx-code-block
@@ -258,11 +261,13 @@ Use JSX for the rest of the line, or prefix the line with some plain text:
+``` ```jsx **Bold doesn't work** ``` +```mdx-code-block
@@ -278,6 +283,7 @@ Use JSX for the rest of the line, or prefix the line with some plain text: Use JSX within JSX tag, or move the Markdown to the outer layer:
+``` ```jsx Bold now works @@ -285,6 +291,7 @@ Use JSX within JSX tag, or move the Markdown to the outer layer: **Bold now works** ``` +```mdx-code-block
@@ -303,13 +310,13 @@ Use JSX within JSX tag, or move the Markdown to the outer layer:
- -```jsx -
-**Bold still doesn't work** -
``` +```jsx +
**Bold still doesn't work**
+``` + +```mdx-code-block
@@ -326,15 +333,13 @@ Use JSX within JSX tag, or move the Markdown to the outer layer: Add an empty new line:
- -```jsx -
- -**Bold now works** - -
``` +```jsx +
**Bold now works**
+``` + +```mdx-code-block
@@ -353,15 +358,13 @@ Add an empty new line:
- -```jsx -
- - You may think I'm just some text... - -
``` +```jsx +
You may think I'm just some text...
+``` + +```mdx-code-block
@@ -380,15 +383,13 @@ Add an empty new line: Don't indent:
- -```jsx -
- -Now I'm actually just text - -
``` +```jsx +
Now I'm actually just text
+``` + +```mdx-code-block
@@ -402,7 +403,7 @@ Now I'm actually just text
-```` +``` ## Importing code snippets {#importing-code-snippets} diff --git a/website/docs/swizzling.md b/website/docs/swizzling.md index d1cf3347a6..d5ef94c863 100644 --- a/website/docs/swizzling.md +++ b/website/docs/swizzling.md @@ -41,9 +41,10 @@ npm run swizzle It will generate a new component your `src/theme` directory, which should look like this example: -````mdx-code-block +```mdx-code-block +``` ```jsx title="src/theme/SomeComponent.js" import React from 'react'; @@ -60,8 +61,10 @@ export default function SomeComponent(props) { } ``` +```mdx-code-block +``` ```jsx title="src/theme/SomeComponent.js" import React from 'react'; @@ -78,9 +81,10 @@ export default function SomeComponentWrapper(props) { } ``` +```mdx-code-block -```` +``` To get an overview of all the themes and components available to swizzle, run: