Node doc
Node doc is a documenting tool. You can extract documentation from your source code and convert it into markdown, for easy use in for example GitHub.
Installation
Requires Node.js and run npm install -g node-doc
Getting started
- Install Node doc, see above.
- Open you terminal of choice an go to your code.
- run
nodedoc SOURCE_DIR
, for examplenodedoc lib
. - Look into the
doc
folder and see the result.
Tags
Access
/** * Private access. * @access private * or * @private */ {} /** * Public access. * @access public * or * @public */ {}
Callback
/** * Specifiy an callback * @callback name Description. * * example: * @callback myCallback I call it, whenever I like to. * Also, it accept multiline descriptions. * @param error * @param result */ /** * Do some async stuff * * @param stuff * @param cb */ { // do async stuff ;};
Constant
/** * A constant variable. * @constant name * * example: * @constant MY_CONSTANT */var MY_CONSTANT = 10;
Constructor
/** * Indicate that a function is a constructor. * @constructor */ {}
Deprecated
/** * Indicate that a function is deprecated. * @deprecated */ {}
Example
/** * Specify an example (one is also auto generated). * @example your example, * accepts multiline comments. * * @example * var parser = require('parser'); * var doc = parser(input, output, 'markdown'); * // or don't save it * var doc = parser(input, 'markdown'); */ {}
Param
/** * A function parameter. * @param name * * example: * @param param1 * @param param2 * @param param3 My parameter. * @param param4 * @param param4.subparameter */ {}
Return
/** * What a function returns. * @return * or * @returns * * example: * @return * @return .subparameter */ { return subparameter: 'Hi' ;}
This
/** * Description of the the this object * @this Desciption. * or define a property of this * @this .property * * example: * @this .name */ {}
Throws
/** * An error that a function might throw * @throw Error description. * or * @throws Error description. * * example: * @throw You broke me! This happend because..? * I don't know. */ { throw 'You broke me! This happend because..? I don\'t know.';}
Todo
/** * When we still need to do some stuff, globally or per function. * @todo finish this. * or * @todo * - finish.. * - this. * * example: * @todo Make better documentation. * @todo * - Write some more tests. * - Make this work. * - Then make it faster. */
Want more examples?
If you want more examples, check the code in the lib directory. Because of course I document my own code :).
Want to see the result?
In the doc directory you can see the result of documenting this code.
Tests
Run tests with npm test
.
Coverage
I try to get 100% coverage, you can see it for yourself with npm run-script coverage
.