mirror of
https://github.com/facebook/docusaurus.git
synced 2025-05-11 08:07:26 +02:00
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:
parent
65842ba3f4
commit
5f1edd5ac8
1 changed files with 2 additions and 2 deletions
|
@ -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>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue