Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
CoffeeScript API documentation generator. It's like YARD but for CoffeeScript!
branch: master

This branch is 196 commits ahead, 100 commits behind coffeedoc:master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
bin
config
lib
spec
src
theme/default
.codoopts
.gitignore
.travis.yml
CHANGELOG.md
Gemfile
Guardfile
LICENSE.md
README.md
package.json

README.md

Codo Build Status

Codo is a CoffeeScript API documentation generator, similar to YARD. Its generated documentation is focused on CoffeeScript class syntax for classical inheritance and not for JavaScript's prototypal inheritance.

Codo in action

You can browse the Codo documentation, which contains a sample class Example.Animal that makes use of all available tags. In addition, there's a list of Codo generated documentations in the wiki.

Installation

Codo is available in NPM and can be installed with:

$ npm install -g codo

Tags

Codo comments are rendered as GitHub Flavored Markdown and can be tagged to add more structured information to class and method comments.

Tags can take multiple lines, just indent subsequent lines by two spaces.

Overview

Tag format Multiple occurrences Class level Module level Method level
@abstract (message)
@author name
@copyright name
@deprecated
@example (title)
  Code
@note message
@option option [type] name description
@param [type] name description
@param name [type] description
@private
@return [type] description
@see link/reference
@since version
@todo message
@version version
@module version

References

Class/method comments and all tags texts will be parsed for references to other classes/methods and are linked automatically. You can use:

  • Normal links, e.g. {http://coffeescript.org/}
  • Link to a class, e.g. {Animal.Lion}
  • Link to an instance method, e.g. {Animal.Lion#walk}
  • Link to a class method, e.g. {Animal.Lion.constructor}

If you are referring to a method within the same class, you can omit the class name, like {#walk}. You can set an explicit label for the link by adding the label after the reference, e.g. {#walk The lion walks}.

The @see tag supports the same linking, just without the curly braces, e.g. @see http://en.wikipedia.org/wiki/Lion The wikipedia page about lions

Example

# Base class for all animals.
#
# @note This is not used for codo, its purpose is to show
#   all possible tags within a class.
#
# @todo Provide more examples
#
# @example How to subclass an animal
#   class Lion extends Animal
#     move: (direction, speed): ->
#
# @abstract Each animal implementation must inherit from {Animal}
#
# @author Michael Kessler
# @deprecated This class is not used anymore
# @version 0.2.0
# @since 0.1.0
#
class Example.Animal

  # The Answer to the Ultimate Question of Life, the Universe, and Everything
  @ANSWER = 42

  # Construct a new animal.
  #
  # @todo Clean up
  # @param [String] name the name of the animal
  # @param [Date] birthDate when the animal was born
  #
  constructor: (@name, @birthDate = new Date()) ->

  # Move the animal.
  #
  # @example Move an animal
  #   new Lion('Simba').move('south', 12)
  #
  # @abstract
  # @param [Object] options the moving options
  # @option options [String] direction the moving direction
  # @option options [Number] speed the speed in mph
  #
  move: (options = {}) ->

  # Copulate another animal.
  #
  # @note Don't take it seriously
  #
  # @private
  # @author Michael Kessler
  # @param [Animal] animal the partner animal
  # @return [Boolean] true when success
  # @deprecated Do not copulate
  # @version 0.2.0
  # @since 0.1.0
  #
  copulate: (animal) =>

  # Moves all animal into the ark.
  #
  # @return [Boolean] true when all in Ark
  #
  @enterArk: ->

Generate

After the installation you will have a codo binary that can be used to generate the documentation recursively for all CoffeeScript files within a directory.

$ codo --help
Usage: codo [options] [source_files [- extra_files]]

Options:
  -r, --readme      The readme file used                [default: "README.md"]
  -q, --quiet       Show no warnings                    [boolean]  [default: false]
  -o, --output-dir  The output directory                [default: "./doc"]
  -v, --verbose     Show parsing errors                 [boolean]  [default: false]
  -h, --help        Show the help
  --private         Show private methods and classes
  --title                                               [default: "CoffeeScript API Documentation"]

Project defaults

You can define your project defaults by write your command line options to a .codoopts file:

--readme     README.md
--title      "Codo Documentation"
--private
--quiet
--output-dir ./doc
./src
-
LICENSE
CHANGELOG.md

Report issues

Issues hosted at GitHub Issues.

The codo specs are template based, so make sure you provide a code snippet that can be added as failing spec to the project when reporting an issue with parsing your CoffeeScript code.

You can check if some parsing errors have occured by running codo in verbose mode.

Development

Source hosted at GitHub.

Pull requests are very welcome! Please try to follow these simple rules if applicable:

  • Please create a topic branch for every separate change you make.
  • Make sure your patches are well tested.
  • Update the documentation.
  • Update the README.
  • Update the CHANGELOG for noteworthy changes.
  • Please do not change the version number.

Acknowledgment

  • Jeremy Ashkenas for CoffeeScript, that mighty language that compiles to JavaScript and makes me enjoy JavaScript development.
  • Loren Segal for creating YARD and giving me the perfect documentation syntax for dynamic programming languages.

Alternatives

  • Docco is a quick-and-dirty, literate-programming-style documentation generator.
  • CoffeeDoc an alternative API documentation generator for CoffeeScript.
  • JsDoc an automatic documentation generator for JavaScript.
  • Dox JavaScript documentation generator for node using markdown and jsdoc.

Contributors

Author

License

(The MIT License)

Copyright (c) 2012 Michael Kessler

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Something went wrong with that request. Please try again.