Assuming I have some object, what the is way to comment it using jsdoc3?
/**
* Test object
* @namespace test
*/
var test = {
/**
* Some defaults
* @memberOf test
*/
defaults: {
'test1': 1,
'test2': 2
},
/**
* Somthing else
* @memberOf test
*/
deep: {
/**
* Some option
* @memberOf {test.deep}
*/
option: {},
/**
* Some method
* @memberOf test.deep
*/
method: {},
/**
* Some option
* @memberOf {test.deep.evenMore}
*/
evenMore: {
/**
* Some option
* @memberOf test.deep.evenMore
*/
test: false
}
}
};
But jsdoc creates documentation only for Namespace: test and members deep, defaults
Namespace: test test Test object
Members
deep Somthing else
defaults Some defaults
JSDoc comments should generally be placed immediately before the code being documented. Each comment must start with a /** sequence in order to be recognized by the JSDoc parser. Comments beginning with /* , /*** , or more than 3 stars will be ignored.
The @param tag provides the name, type, and description of a function parameter. The @param tag requires you to specify the name of the parameter you are documenting. You can also include the parameter's type, enclosed in curly brackets, and a description of the parameter.
Press Ctrl+Shift+O for viewing all the methods and corresponding JSDoc opens up when you select a method there and hover over the method.
JsDoc provides two types of tags: block tags and inline tags. Block tags provide means to annotate variables, functions, arguments, modules, namespaces, return types, and classes and describe what a specific code snippet does. These could be types, arguments, callbacks, modules, namespaces, etc.
As @Scottux said, the only way to archieve this is naming additional namespaces.
/**
* Test object
* @namespace test
*/
var test = {
/**
* Some defaults
* @memberOf test
*/
defaults: {
'test1': 1,
'test2': 2
},
/**
* Somthing else
* @memberOf test
* @namespace test.deep
*/
deep: {
/**
* Some option
* @memberOf test.deep
*/
option: {},
/**
* Some method
* @memberOf test.deep
*/
method: {},
/**
* Some option
* @memberOf test.deep
* @namespace test.deep.evenMore
*/
evenMore: {
/**
* Some option
* @memberOf test.deep.evenMore
*/
test: false
}
}
};
The generated documentation will look like this:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With