Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An API documentation generator for CoffeeScript

tag: v0.1.3

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 bin
Octocat-spinner-32 lib
Octocat-spinner-32 resources
Octocat-spinner-32 src
Octocat-spinner-32 vendor
Octocat-spinner-32 Cakefile
Octocat-spinner-32 package.json


An API documentation generator for CoffeeScript

CoffeeDoc is a simple API documentation generator for CoffeeScript. It reads python-style docstrings in your CoffeeScript class and function definitions, passes them through Markdown, and outputs the result as easy to read HTML.

CoffeeDoc is inspired by the excellent Docco, and is intended for projects that require more structured API documentation.

The docstring convention CoffeeDoc uses is inspired by Python, and looks like this:

# CoffeeDoc example documentation #

This is a module-level docstring, and will be displayed at the top of the module documentation.
Documentation generated by [CoffeeDoc](

class MyClass extends Superclass
    This docstring documents MyClass. It can include *Markdown* syntax,
    which will be converted to html.
    constructor: (@args) ->
        ### Constructor documentation goes here. ###

    method: (args) ->
        ### This is a method of MyClass ###

myFunc = (arg1, arg2, args...) ->
    This function will be documented by CoffeeDoc

The documentation generated from the above script can be seen here. For a more interesting example, here is the result of running coffeedoc against src/


CoffeeDoc requires Node.js, CoffeeScript, and eco. Install using npm with the following command:

sudo npm install -g coffeedoc

The -g option installs CoffeeDoc globally, adding the coffeedoc executable to your PATH. If you would rather install locally, omit the -g option.

You can also install from source using cake. From the source directory, run:

sudo cake install


CoffeeDoc can be run from the command line:

coffeedoc src/*.coffee

Generated documentation is saved to the docs/ folder under the current directory. If you wish to document several modules, make sure you generate all the docs with a single command -- this ensures that they will all appear in the index.html file.

How it works

CoffeeDoc uses the CoffeeScript parser to generate a parse tree for the given source files. It then extracts the relevant information from the parse tree: class and function names, class member functions, function argument lists and docstrings.

Docstrings are defined as the first herecomment block following the class or function definition. Note that regular single line comments will be ignored. Docstrings are passed through Showdown, a javascript port of Markdown (CoffeeDoc uses jashkenas' modified version of Showdown used in Docco).

The resulting documentation information is then passed to an eco template to generate the html output.


CoffeeDoc is © 2011 Omar Khan, released under the MIT licence. Use it, fork it.

Something went wrong with that request. Please try again.