我尝试在选项卡中添加降价代码,如文档中所述。
名称文件名具有.mdx
扩展名。
这里是它的内容:
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
<Tabs
defaultValue="javascript"
values={[
{label: 'Javascript', value: 'javascript'},
{label: 'Other', value: 'other'},
]}>
<TabItem value="javascript">
```jsx
Formated code here
```
</TabItem>
<TabItem value="other">This is an orange </TabItem>
</Tabs>
但我收到了这个错误:
SyntaxError: /home/angelcc/projects/simplex/osm4scala/website/docs/example.mdx: Expected corresponding JSX closing tag for <TabItem> (21:0)
19 | <TabItem value="other">This is an orange </TabItem>
20 | `}</code></pre>
> 21 | </Tabs>
| ^
22 | </MDXLayout>
23 | )
24 | };
不知道我做错了什么。
版本:
"@docusaurus/core": "2.0.0-alpha.72",
"@docusaurus/preset-classic": "2.0.0-alpha.72",
"@mdx-js/react": "^1.6.21",
"clsx": "^1.1.1",
"react": "^17.0.1",
"react-dom": "^17.0.1"
npm 6.12.1
node v12.13.1
有什么建议吗?