How do I set a JSDoc tutorial title?

廉价感情. 提交于 2019-12-11 03:39:43

问题


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.

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:

Each tutorial file can have additional .js/.json file (with same name, just different extension) which will hold additional tutorial configuration. Two fields are supported:

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.

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?

(Edited to include one .js file I tried, which did not change the tutorial display name.)

tutorial1.md

First Tutorial
================

tutorial1.js

/**
 @title First Tutorial
 */
@title = "First Tutorial";
title = "First Tutorial";

回答1:


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.

With a .json extension, and using jsdoc 3.2.2, the following works:

{
    "title": "Custom Title"
}

Your .json file needs to be in the same directory as your .md file and have the same name (ignoring extensions).



来源:https://stackoverflow.com/questions/22495502/how-do-i-set-a-jsdoc-tutorial-title

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!