问题描述
我正在使用JSDoc教程,如 http://usejsdoc.org/about-tutorials中所述. html
I'm using JSDoc tutorials, as described in http://usejsdoc.org/about-tutorials.html
我无法使用配置选项,并且还没有在线找到有关该主题的任何示例或讨论.
I can't get the configuration options to work, and I haven't yet found any examples or discussion of the topic online.
在一个简单的示例中,我向JSDoc传递了一个 tutorials 参数,它为tutorial1.md构建了一个教程文件.我想给本教程起一个第一教程"的显示名称.
In my trivial example, I pass a tutorials parameter to JSDoc, and it builds a tutorial file for tutorial1.md. I would like to give this tutorial a display name of "First Tutorial".
以下是在线文档中的内容:
Following this from the online docs:
标题会用其值中指定的名称覆盖教程的显示名称(教程的默认标题是它的文件名).
title overrides display name for tutorial with the one specified in it's value (default title for tutorial is it's filename).
拥有子教程标识符列表的孩子.
children which holds list of sub-tutorials identifiers.
我尝试了几次尝试,以添加tutorial1.json或tutorial1.js,但是JSDoc戳了json文件,或者似乎无法识别我在js文件中扔给它的任何东西.
I tried several attempts at adding tutorial1.json, or tutorial1.js but either JSDoc pukes on the json file, or doesn't seem to recognize anything I throw at it in the js file.
有人可以为应该使用的教程配置文件建议一种简单的格式吗?
Can anyone suggest a simple format for a tutorial configuration file that should work?
(已编辑,其中包含我尝试的一个.js文件,但未更改教程的显示名称.)
(Edited to include one .js file I tried, which did not change the tutorial display name.)
tutorial1.md
tutorial1.md
First Tutorial
================
tutorial1.js
tutorial1.js
/**
@title First Tutorial
*/
@title = "First Tutorial";
title = "First Tutorial";
推荐答案
它可用于.json
扩展名,但不能与.js
扩展名一起使用.如果使用.js
扩展名,jsdoc似乎甚至不会尝试读取.因此,文档似乎不正确.
It works with .json
extension but not with a .js
extension. jsdoc does not seem to try to even read the file if a .js
extension is used. So the doc seems incorrect.
具有.json
扩展名,并使用jsdoc 3.2.2,可以进行以下工作:
With a .json
extension, and using jsdoc 3.2.2, the following works:
{
"title": "Custom Title"
}
您的.json
文件必须与.md
文件位于同一目录中,并且具有相同的名称(忽略扩展名).
Your .json
file needs to be in the same directory as your .md
file and have the same name (ignoring extensions).
这篇关于如何设置JSDoc教程标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!