我想了解是否有办法让我在由 dartdoc
生成的 API 文档中包含其他文档。 .
根据Package layout conventions有一个 getting_started.md
文件包含在 doc/
中目录并显示如下...
enchilada/
...
doc/
api/ ***
getting_started.md
该文件如何通过
dartdoc
合并到文档中它在输出中显示在哪里?我试图简单地添加我自己的 *.md
doc/
中的文件目录,但它们似乎没有被使用。我也读过 分类 在 dartdoc documentation其中指出:
categories: More details for each category/topic. For topics you'd like to document, specify the markdown file with markdown: to use for the category page. Optionally, rename the category from the source code into a display name with 'name:'. If there is no matching category defined in dartdoc_options.yaml, those declared categories in the source code will be invisible.
于是我尝试引用了
dartdoc_options.yaml
中的附加文档。像这样的文件...dartdoc:
categories:
"Getting Started":
markdown: doc/getting_started.md
"Search Filters":
markdown: doc/search_filters.md
categoryOrder: ["Getting Started", "Search Filters"]
但这也没有产生任何结果。
有谁知道是否可以包含其他文档以及如何完成此操作?
最佳答案
Dartdoc 不允许在 API 文档中包含任意 .md 文件。您可以在 README.md 或其他文档中创建指向它们的链接,例如通过 GitHub 或其他为他们服务的网址。
例如,dartdoc 包为“贡献”文档执行此操作,它显示在 API 文档中,此处:https://pub.dev/documentation/dartdoc/3.0.0/index.html
只有在源代码中至少有一个元素被声明为该类别的成员时,类别才会呈现,因此该功能不太适合此用例。
关于dart - 如何让 dartdoc 包含其他文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56413614/