Notes on YUI Doc

You must install nodejs, and you must also install the node package manager (npm). The easiest way to do this on windows
is to go to http://nodejs.org/#download and chose the windows installer

After you get npm installed, open cmd and type this:
npm -g install yuidocjs

For notes on how to comment your code to use YUIDoc, go to http://yui.github.com/yuidoc/
See below for a few simple rules

When you are ready to generate documentation you should create a file called yuidoc.json. This is a configuration file for your
project. It will look something like this:

{
    "name": "The Foo API",
    "description": "The Foo API: a library for doing X, Y, and Z",
    "version": "1.2.1",
    "url": "http://example.com/",
    "options": {
        "outdir": "../build/apidocs"
    }
}

To generate your docs (after you have set up your yuidoc.json file, open a cmd prompt and navigate to your project folder then type this:

yuidoc .

For a list of flags that you can pass into the yuidoc command, click here.

A few simple rules about using YUIDoc:

  • For YUIDoc to see your comment it must start like this /** not /*
  • A source tree must contain at least one comment block with a 'module' tag.
  • Each module must have at least one comment block with a 'class' tag.
  • Each class may then have zero or more comment blocks with an attribute, 'class', 'event', 'method', or 'property tag'.

 

Notes on some of the tags in YUI doc:

@module - for a group of related classes

@param [someparam] {Object}  - an optional param of type Object

@param [someparam.somekey] {Number} - an optional key in the optional someparam

@param [someparam=False] {Boolean} - an optional param that defaults to false if not passed in

@param someparam {HTML | String} - a param that can be either a string or and html (string)

@chainable - put this on a function that returns 'this'

 

To put some example code in the docs (put a tab before each line of sample code):

 

@example
events: {
".some-class:click": function(event, building, buildingList){...}
}