问题描述
这是我第一次被要求编写文档,而我选择使用jsdoc的方式.
This is my first time been asked to write a documentation and my choice of way to do it is by using jsdoc.
以下是我的jsdoc的示例jsdoc.json配置文件.它只读取一个README.md文件.
This following is the sample jsdoc.json config file for my jsdoc. It read just a single README.md file.
{
"source": {
"include": "./client/src",
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": true,
"monospaceLinks": true,
},
"opts": {
"recurse": true,
"destination": "./docs/",
"readme": "./README.md"
}
}
如何使它像读取index.md和content.md一样读取多个.md文件?
How can I make it to read multiple .md file like if I have index.md and content.md?
推荐答案
我只是想做同样的功能,我发现的方法并不完美,但效果很好.JSDOC中有一个称为教程"的功能.
I just wanted to do the same functionality, and the approach that I found is not perfect, but it works good enough.In JSDOC there is an functionality called "tutorials".
我所做的,是在我的项目文件夹"Tutorials"的根目录上创建的,并将以下内容添加到我的配置文件的"opts"部分:
What I have done, is created on the root of my project folder "Tutorials" and added to the "opts" section in my config file the following:
"opts": {
"tutorials": "./Tutorials",
}
在tutorials文件夹中,您需要创建尽可能多的.md文件,请记住每个教程都必须具有唯一的名称.
In the tutorials folder you create as many .md files you need, keeping in mind that every tutorial needs to have unique name.
每次您想将某些内容与特定教程(例如称为"content.md"的教程)连接时,都需要放置
Every time you want to connect something with specific tutorial (for example tutorial called "content.md") you need to put
{@tutorial content}
这在Readme.md和您有文档的任何js文件中均可使用.您也可以将一个教程与另一个教程联系起来.
This works in both Readme.md and any js file you have documentation. Also you can connect one tutorial with another.
您可以在此处了解有关此功能的更多信息:
you can learn more about the feature here:
https://jsdoc.app/about-tutorials.html
https://jsdoc.app/tags-inline-tutorial.html
我的回答有点晚了,但是我希望这至少可以对您将来的项目有所帮助:)
my answer is a bit late, but I hope this can at least help you for future projects :)
这篇关于JSDoc:如何包含多个.md文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!