问题
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