我正在使用Docusaurus构建文档。Docusaurus使用MDX
我想在文档中使用代码块显示一个.json文件,而无需复制/跳过文件内容。
而不是写在我的md文档:
Let see the content of the `helloworld.json` file :
'''json title="helloworld.json"
{
"hello":"world"
}
'''
我想要一个asserts/helloworld.json
文件,并做一些类似的事情:
Let see the content of the `helloworld.json` file :
'''json title="helloworld.json" from "asserts/helloworld.json"
'''
遵循此处的指南:https://docusaurus.io/docs/markdown-features/react#importing-代码片段
您可以将代码片段作为原始文本React组件导入,并将其添加到代码块中。