` component.
+
+```jsx
+
+ Input: 1 2 3 4{'\n'}
+ Output: "366300745"{'\n'}
+
+```
+
+
+
+ Input: 1 2 3 4{'\n'}
+ Output: "366300745"{'\n'}
+
+
+
+:::caution MDX is whitespace insensitive
+
+MDX is in line with JSX behavior: line break characters, even when inside ``, are turned into spaces. You have to explicitly write the new line character for it to be printed out.
+
+:::
+
+:::caution
+
+Syntax highlighting only works on plain strings. Docusaurus will not attempt to parse code block content containing JSX children.
+
+:::
+
## Multi-language support code blocks {#multi-language-support-code-blocks}
-With MDX, you can easily create interactive components within your documentation, for example, to display code in multiple programming languages and switching between them using a tabs component.
+With MDX, you can easily create interactive components within your documentation, for example, to display code in multiple programming languages and switch between them using a tabs component.
Instead of implementing a dedicated component for multi-language support code blocks, we've implemented a generic Tabs component in the classic theme so that you can use it for other non-code scenarios as well.
-The following example is how you can have multi-language code tabs in your docs. Note that the empty lines above and below each language block is **intentional**. This is a current limitation of MDX, you have to leave empty lines around Markdown syntax for the MDX parser to know that it's Markdown syntax and not JSX.
+The following example is how you can have multi-language code tabs in your docs. Note that the empty lines above and below each language block are **intentional**. This is a current limitation of MDX: you have to leave empty lines around Markdown syntax for the MDX parser to know that it's Markdown syntax and not JSX.
````jsx
import Tabs from '@theme/Tabs';
@@ -409,6 +488,7 @@ class HelloWorld {
And you will get the following:
````mdx-code-block
+
@@ -439,6 +519,7 @@ class HelloWorld {
+
````
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).
@@ -489,3 +570,39 @@ npm install @docusaurus/remark-plugin-npm2yarn
````
Using the `{sync: true}` option would make all tab choices synced. Because the choice is stored under the same namespace `npm2yarn`, different `npm2yarn` plugin instances would also sync their choices.
+
+## Usage in JSX {#usage-in-jsx}
+
+Outside of Markdown, you can use the `@theme/CodeBlock` component to get the same output.
+
+```jsx
+import CodeBlock from '@theme/CodeBlock';
+
+export default function MyReactPage() {
+ return (
+
+ {/* highlight-start */}
+
+ {`function HelloCodeTitle(props) {
+ return Hello, {props.name}
;
+}`}
+
+ {/* highlight-end */}
+
+ );
+}
+```
+
+
+
+ {`function HelloCodeTitle(props) {
+ return Hello, {props.name}
;
+}`}
+
+
+
+The props accepted are `language` and `title`, in the same way as you write Markdown code blocks.
+
+Although discouraged, you can also pass in a `metastring` prop like `metastring='{1-2} title="/src/components/HelloCodeTitle.js"'`, which is how Markdown code blocks are handled under the hood. However, we recommend you [use comments for highlighting lines](#highlighting-with-comments).
+
+As [previously stated](#using-jsx-markup), syntax highlighting is only applied when the children is a simple string.
diff --git a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-head-metadata.mdx b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-head-metadata.mdx
similarity index 81%
rename from website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-head-metadata.mdx
rename to website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-head-metadata.mdx
index c48caf9fcc..fa987eb1fe 100644
--- a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-head-metadata.mdx
+++ b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-head-metadata.mdx
@@ -48,7 +48,13 @@ My text
This `` declaration has been added to the current Markdown doc, as a demo.
-Open your browser DevTools and check how this page's metadata have been affected.
+Open your browser DevTools and check how this page's metadata has been affected.
+
+:::
+
+:::tip
+
+**You don't always need this for typical SEO needs.** Content plugins (e.g. docs and blog) provide front matter options like `description`, `keywords`, and `image`, which will be automatically applied to both `description` and `og:description`, while you would have to manually declare two metadata tags when using the `` tag.
:::
diff --git a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-headings.mdx b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-headings.mdx
similarity index 82%
rename from website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-headings.mdx
rename to website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-headings.mdx
index c52a7975ea..a4beb7bba3 100644
--- a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-headings.mdx
+++ b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-headings.mdx
@@ -17,11 +17,11 @@ You can use regular Markdown headings.
#### Level 4 title
```
-Markdown headings appear as a table-of-contents entry.
+Markdown headings appear as a table of contents entry.
## Heading ids {#heading-ids}
-Each heading has an id that can be automatically generated, or explicitly specified.
+Each heading has an id that can be automatically generated or explicitly specified.
Heading ids allow you to link to a specific document heading in Markdown or JSX:
@@ -35,9 +35,7 @@ Heading ids allow you to link to a specific document heading in Markdown or JSX:
### Generated ids {#generated-ids}
-By default, Docusaurus will generate heading ids for you, based on the heading text.
-
-`### Hello World` will have id `hello-world`.
+By default, Docusaurus will generate heading ids for you, based on the heading text. For example, `### Hello World` will have id `hello-world`.
Generated ids have **some limits**:
diff --git a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-inline-toc.mdx b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-inline-toc.mdx
similarity index 91%
rename from website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-inline-toc.mdx
rename to website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-inline-toc.mdx
index 3726f04842..c8a8eaf567 100644
--- a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-inline-toc.mdx
+++ b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-inline-toc.mdx
@@ -13,7 +13,7 @@ But it is also possible to display an inline table of contents directly inside a
## Full table of contents {#full-table-of-contents}
-The `toc` variable is available in any MDX document, and contains all the headings of a MDX document.
+The `toc` variable is available in any MDX document and contains all the headings of an MDX document.
By default, only `h2` and `h3` headings are displayed in the TOC. You can change which heading levels are visible by setting `minHeadingLevel` or `maxHeadingLevel`.
@@ -61,9 +61,7 @@ import TOCInline from '@theme/TOCInline';
```mdx-code-block
-
-
```
@@ -71,7 +69,7 @@ import TOCInline from '@theme/TOCInline';
:::caution
-The underlying content is just an example to have more table-of-contents items available in current page.
+Below is just some dummy content to have more table of contents items available on the current page.
:::
diff --git a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-intro.mdx b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-intro.mdx
similarity index 79%
rename from website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-intro.mdx
rename to website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-intro.mdx
index da448446f4..0f5c99cca3 100644
--- a/website/versioned_docs/version-2.0.0-beta.13/guides/markdown-features/markdown-features-intro.mdx
+++ b/website/versioned_docs/version-2.0.0-beta.15/guides/markdown-features/markdown-features-intro.mdx
@@ -6,15 +6,11 @@ description: Docusaurus uses GitHub Flavored Markdown (GFM). Find out more about
slug: /markdown-features
---
-```mdx-code-block
import BrowserWindow from '@site/src/components/BrowserWindow';
-```
Documentation is one of your product's interfaces with your users. A well-written and well-organized set of docs helps your users understand your product quickly. Our aligned goal here is to help your users find and understand the information they need, as quickly as possible.
-Docusaurus 2 uses modern tooling to help you compose your interactive documentations with ease. You may embed React components, or build live coding blocks where your users may play with the code on the spot. Start sharing your eureka moments with the code your audience cannot walk away from. It is perhaps the most effective way of attracting potential users.
-
-In this section, we'd like to introduce you to the tools we've picked that we believe will help you build a powerful documentation. Let us walk you through with an example.
+Docusaurus 2 uses modern tooling to help you compose your interactive documentation with ease. You may embed React components, or build live coding blocks where your users may play with the code on the spot. Start sharing your eureka moments with the code your audience cannot walk away from. It is perhaps the most effective way of attracting potential users.
:::important
@@ -31,7 +27,7 @@ The [standard Markdown syntax](https://daringfireball.net/projects/markdown/synt
```md
### My Doc Section
-Hello world message with some **bold** text, some _italic_ text and a [link](/)
+Hello world message with some **bold** text, some _italic_ text, and a [link](/)

```
@@ -53,10 +49,18 @@ Hello world message with some **bold** text, some _italic_ text and a [link](/)
Markdown quotes are beautifully styled:
```md
-> This is a quote
+> Easy to maintain open source documentation websites.
+>
+> — Docusaurus
```
-> This is a quote
+
+
+> Easy to maintain open source documentation websites.
+>
+> — Docusaurus
+
+
## Details
@@ -104,8 +108,6 @@ Markdown can embed HTML elements, and [`details`](https://developer.mozilla.org/