npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

coffeedoc-lm

v0.1.12

Published

Fork of CoffeeDoc by Larry Maccherone - an API documentation generator for CoffeeScript

Downloads

2

Readme

CoffeeDoc

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](http://github.com/omarkhan/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
    ###
    doSomething()

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.coffee.

Installation

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

sudo npm install -g coffeedoc-lm

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

Usage

CoffeeDoc can be run from the command line:

Usage: coffeedoc [options] [targets]

Options:
    -o, --output: Set output directory (default: ./docs)
    --commonjs  : Use if target scripts use CommonJS for module loading (default)
    --requirejs : Use if target scripts use RequireJS for module loading
    --readme    : Generates a draft README.md from the module docstrings
    -r, --rout  : Set output file for README.md (defaults to stdout)

If [targets] is a directory, CoffeeDoc will recursively document all .coffee files found under that 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.

Note that since coffeedoc is intended to document the public API, any functions or methods that begin with underscore (_) will be omitted from the generated docs.

Note on Markdown headers

Markdown uses # characters for headers, e.g.

# Header 1
## Header 2
### Header 3
#### Header 4
##### Header 5
###### Header 6

As using a sequence of 3 or more # characters within a CoffeeScript block comment would end the comment block, CoffeeDoc allows for the \# escape sequence in docstrings. So instead of ### Header, use \#\#\# Header or ##\# Header. Ugly, but it works.

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.

Licence

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