GRUNT PLUGIN

How It Works

ExplainJS downloads your source code and separates the comments from the code. Comments can be in the form of /* */ or //.

Then each comment is grouped with the following code block. The comment is converted to HTML using the markdown syntax.

Most JavaScript libraries seem to start with a list of data about the repo. For example, the title, url, author, license, description etc. For that reason ExplainJS enforces line breaks on the first comment.

For the rest of the comments, two line breaks cause a newline but one line break is ignored.

I built ExplainJS as a documentation generator for JavaScript, but it actually does ok with other JavaScript-like source files. It works ok with CSS/LESS too.

Why Does ExplainJS Exist?

I was jealous of how underscore and backbone showed their annotated source code. I tried some 3rd party libraries to do the conversion from code -> documentation but it was a pain to setup. Ultimately I wasn't happy with the results and wanted it to be as easy as it could be.

So I figured it couldn't be that hard to build it myself. And I'm pretty obsessed with Node & NPM so I decided to post it with Heroku, NodeJS, and NPM.