documentation
A documentation generation system that's
beautiful by default, flexible across formats and styles, and
powerful enough to support JSDoc's advanced syntax.
ES5 and ES6 support of JavaScript, with support for other transpilers a possibility
Using babel, we have support for a wide range
of ES6 & ES7 features, as well
as Flow type annotations.
Powerful inference
By statically analyzing your JavaScript code, documentation.js can write
many parts of your documentation for you. It can infer parameter names
and types, class membership, return values from Flow types, and lots more.
Support for C++
You can use the --polyglot
mode of documentationjs to document native node.js
modules in JSDoc within the C++ code that implements the feature.
Support for following dependency trees
Using module-deps, documentation
can
crawl require()
graphs - pointing it to your app's main
file will find all
referenced files and include all of their documentation.
GitHub Integration
The --github
option automatically permalinks documentation to the exact
sections of code it refers to in a GitHub repository.
Gulp integration
The gulp-documentation project
lets you run documentation
as a Gulp build task.
Documentation
-
Getting Started: start here
-
Usage: how to use documentation.js
-
Recipes: tricks for writing effective JSDoc docs
-
Node API: documentation.js's self-generated documentation
-
FAQ
-
Theming: tips for theming documentation output in HTML
-
See also: a list of projects similar to documentation.js
User Guide
Globally install documentation
using the npm package manager:
$ npm install -g documentation
This installs a command called documentation
in your path, that you can
point at JSDoc-annotated source code to generate
human-readable documentation. First run documentation
with the -h
option for help:
$ documentation -h
Usage: documentation <command> [options]
Options:
--lint check output for common style and uniformity mistakes
[boolean]
-t, --theme specify a theme: this must be a valid theme module
-p, --private generate documentation tagged as private [boolean]
--version Show version number [boolean]
--name project name. by default, inferred from package.json
--project-version project version. by default, inferred from package.json
--shallow shallow mode turns off dependency resolution, only
processing the specified files (or the main script
specified in package.json) [boolean] [default: false]
--polyglot polyglot mode turns off dependency resolution and enables
multi-language support. use this to document c++ [boolean]
-g, --github infer links to github in documentation [boolean]
-o, --output output location. omit for stdout, otherwise is a filename
for single-file outputs and a directory name for multi-file
outputs like html [default: "stdout"]
-c, --config configuration file. an array defining explicit sort order
-h, --help Show help [boolean]
-f, --format [choices: "json", "md", "html"] [default: "json"]
Examples:
documentation foo.js parse documentation in a given file
We have plenty of
issues that we'd
love help with.
- Robust and complete
JSDoc
support, including typedefs. - Strong support for HTML and Markdown output
- Documentation coverage, statistics, and validation
documentation is an OPEN Open Source Project. This means that:
Individuals making significant and valuable contributions are given
commit-access to the project to contribute as they see fit. This
project is more like an open wiki than a standard guarded open source project.
4.0.0-beta
Revitalized documentation.js command line interface!
The documentation
utility now takes commands:
documentation build
extracts and formats documentationdocumentation serve
provides an auto-reloading server (#236)documentation lint
reviews files for inconsistenciesdocumentation readme
patches API documentation into a readme (#313 by @anandthakker)
This functionality was previously included in dev-documentation
and has
been folded into documentation
proper.
Much more flexible themes
Themes are now much more customizable. In documentation.js 3.x and before, themes
were required to use Handlebars templates and produce a single page. In
documentation.js 4.x and beyond, they are JavaScript modules that can use
any template engine and produce any number of files. See the
new theme documentation for
details.
More precise traversal
Inference in 4.x is stricter than in 3.x: comments must be adjacent
to the statements they document. This should make documentation generation
much more predictable.
Support for the revealing module pattern
/** Foo */
function Foo() {
/** Test */
function bar() {}
return {
bar: bar
};
}
New support for the JavaScript module pattern!
This was implemented in #324
by Charlie Brown.
Breaking changes