docs: simplify imported code blocks syntax (#6830)

* refactor: simplify imported code blocks

- Use `language=<lang>` prop instead of "className="language-<lang>" for imported code blocks

I've been using this in my personal projects ([example](https://raw.githubusercontent.com/nathan-contino-mongo/docusaurus-realm/9a2ebb6a43bbbd7b38899fcc86c903dcc1f61283/docs/sdk/kotlin/migrate-from-java-sdk.mdx)) since it is less verbose.
If this interface is somehow less stable than the `className` prop, feel free to close this. But if both will work going forward
we should probably recommend the simpler of the two.

* Update markdown-features-react.mdx
This commit is contained in:
nate contino 2022-03-03 16:09:16 -07:00 committed by GitHub
parent 65842ba3f4
commit 5f1edd5ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -352,7 +352,7 @@ Now you can import code snippets from another file as it is:
import CodeBlock from '@theme/CodeBlock';
import MyComponentSource from '!!raw-loader!./myComponent';
<CodeBlock className="language-jsx">{MyComponentSource}</CodeBlock>
<CodeBlock language="jsx">{MyComponentSource}</CodeBlock>
```
<!-- prettier-ignore-end -->
@ -362,7 +362,7 @@ import MyComponentSource from '!!raw-loader!@site/src/pages/examples/_myComponen
<BrowserWindow>
<CodeBlock className="language-jsx">{MyComponentSource}</CodeBlock>
<CodeBlock language="jsx">{MyComponentSource}</CodeBlock>
</BrowserWindow>