JSDoc:如何包含多个 .md 文件

JSDoc: How to include multiple .md file

这是我第一次被要求编写文档,我选择的方式是使用 jsdoc。

以下是我的 jsdoc 的示例 jsdoc.json 配置文件。它只读取一个 README.md 文件。

{
  "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 文件?

我只是想做同样的功能,我发现的方法并不完美,但效果很好。 在 JSDOC 中有一个名为 "tutorials".

的功能

我所做的是在我的项目文件夹 "Tutorials" 的根目录下创建的,并添加到我的配置文件的 "opts" 部分,如下所示:

"opts": {
   "tutorials": "./Tutorials",
}

在教程文件夹中,您可以根据需要创建任意数量的 .md 文件,请记住每个教程都需要有唯一的名称。

每次你想将某些内容与特定教程(例如名为 "content.md" 的教程)联系起来时,你需要输入

{@tutorial content}

这适用于 Readme.md 和您有文档的任何 js 文件。您也可以将一个教程与另一个教程联系起来。

您可以在此处了解有关该功能的更多信息:

https://jsdoc.app/about-tutorials.html

https://jsdoc.app/tags-inline-tutorial.html

我的回答有点晚了,但我希望这至少能对你以后的项目有所帮助:)