YUIDOC
YUIDOC
YUIDOC is a Node.js application that generate API documentation from comments in source, using a syntax similar to tools like Javadoc and Doxygen, YUIDoc provides.
- Live previews, includes a standalone doc server
- Modern markup
- Wide language support, it is not tied to any particular library or programming lanuage.
Installation and Usage
- Dowload and install Node.js
- Run npm -g install yuidoc.js
- Run yuidoc . all the top of your JS source tree.
Example
- Example Class Block
/* * This is the description for my class. * * @class MyClass * @constructor */
- Example Method Block
/* * My method description. Like other pieces of your comment blocks. * this can span multiple lines * * @method methodName * @param {String} foo Argument 1 * @param {Object} config A config Object * @param {String} config.name The name on the config object * @param {Function} config.callback A callback function on the config object * @param {Boolean} [extra=false] Do extra, optional work * @return {Boolean} Returns true on success * */
- Example Property Block
/* * My property description. Like other pieces of your comment block. * this can span multiple lines.
- @proerty propertyName
- @type {Object}
- @default “foo” */
- Example Code Block
/**
* This is the module description for the YUIDoc
module.
*
* var options = {
* paths: [ ‘./lib’ ],
* outdir: ‘./out’
* };
*
* var Y = require(‘yuidoc’);
* var json = (new Y.YUIDoc(options)).run();
*
* @class YUIDoc
* @main yuidoc
*/
User Guides
Using YUIDoc
Understanding YUIDoc command line arguments and usage.
yuidoc .
Usage: yuidoc
yuidoc.json configuration file
YUIDoc Options: ignorePaths: Use exclude to remove specific directories. exclude: exclude from parses when YUIDoc recurses the source tree. paths: Specifies a single string glob or array of globs to use when searching the source tree for docs to parse. outdir: Specifies the directory in which to place the rendered HTML files and assets.
{
"name": "YUIDoc",
"description": "YUIDoc documentation tool written in JavaScript",
"version": "0.2.38",
"url": "http://yuilibrary.com/projects/yuidoc",
"logo": "http://yuilibrary.com/img/yui-logo.png",
"options": {
"external": {
"data": "http://yuilibrary.com/yui/docs/api/data.json"
},
"linkNatives": "true",
"attributesEmit": "true",
"paths": [
"./lib"
],
"outdir": "./output/api"
}
}
Example: Using preprocessor
This sample yuidoc.json file used preprocessor option:
{ “name”: “My Project”, “version”: “1.0.0”, “options”: { “paths”: “src”, “preprocessor”: [”./path/to/custom_doc_preprocessor.js”, “yuidoc-preprocessor-foo”] } }