包括自述文件
有两种方法可以将 README 文件合并到文档中:
¥There are two ways to incorporate a README file into your documentation:
-
在 JavaScript 文件的源路径中,包含名为
README.md.txt 的 Markdown 文件的路径。JSDoc 将使用它在源路径中找到的第一个README.md文件。¥In the source paths to your JavaScript files, include the path to a Markdown file named
README.md. JSDoc will use the firstREADME.mdfile that it finds in your source paths. -
使用
-R/--readme命令行选项运行 JSDoc,指定README文件的路径。此选项在 JSDoc 3.3.0 及更高版本中可用。README文件可以有任何名称和扩展名,但必须是 Markdown 格式。¥Run JSDoc with the
-R/--readmecommand-line option, specifying the path to yourREADMEfile. This option is available in JSDoc 3.3.0 and later. TheREADMEfile may have any name and extension, but it must be in Markdown format.
-R/--readme 命令行选项优先于源路径。如果你使用 -R/--readme 命令行选项,JSDoc 将忽略源路径中的任何 README.md 文件。
¥The -R/--readme command-line option takes precedence over your source paths. If you use the
-R/--readme command-line option, JSDoc will ignore any README.md files in your source paths.
如果你使用 JSDoc 的默认模板,则 README 文件的内容将以 HTML 形式呈现在生成的文档的 index.html 文件中。
¥If you are using JSDoc's default template, the README file's contents will be rendered in HTML
in the generated documentation's index.html file.
示例
¥Examples
jsdoc path/to/js path/to/readme/README.md
jsdoc --readme path/to/readme/README path/to/js