
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
documentation
Advanced tools
The 'documentation' package is a tool for generating documentation from JavaScript code. It supports various output formats and can be integrated into build processes to automate the creation of documentation.
Generate HTML Documentation
This command generates HTML documentation from the JavaScript files located in the 'src' directory and outputs it to the 'docs' directory. It is useful for creating a visually accessible format of your code's documentation.
documentation build src/** -f html -o docs
Generate Markdown Documentation
This command generates Markdown documentation from the JavaScript files in the 'src' directory and outputs it to a single 'docs.md' file. Markdown is a versatile format that can be easily shared and integrated with various platforms.
documentation build src/** -f md -o docs.md
Serve Documentation Locally
This command starts a local server to serve the documentation generated from the JavaScript files in the 'src' directory. It allows developers to view and interact with the documentation in a web browser during development.
documentation serve src/**
Generate JSON Documentation
This command generates JSON documentation from the JavaScript files in the 'src' directory and outputs it to a 'docs.json' file. JSON format is useful for further processing or integration with other tools.
documentation build src/** -f json -o docs.json
JSDoc is a popular tool for generating documentation from JavaScript source code. It is similar to 'documentation' in that it parses comments in the code to produce documentation. However, JSDoc is more widely used and has a larger community, which can be beneficial for support and finding resources.
TypeDoc is a documentation generator specifically for TypeScript projects. It is similar to 'documentation' but is tailored for TypeScript, providing better support for TypeScript-specific features. It is a good choice if you are working primarily with TypeScript.
ESDoc is a documentation generator for ECMAScript, similar to 'documentation'. It offers features like test coverage and linting for documentation comments. ESDoc is particularly focused on ES6 and beyond, making it a good choice for modern JavaScript projects.
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 espree, we have support for a wide range of ES6 features.
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.
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
Theming HTML: tips for theming documentation output in HTML
See also: a list of projects similar to documentation.js
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:
-f, --format output format, of [json, md, html] [default: "json"]
--lint check output for common style and uniformity mistakes
-t, --theme specify a theme: this must be a valid theme module
-p, --private generate documentation tagged as private
--name project name. by default, inferred from package.json
--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) [default: false]
--polyglot polyglot mode turns off dependency resolution and enables
multi-language support. use this to document c++
-g, --github infer links to github in documentation
-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
Examples:
documentation foo.js parse documentation in a given file
We have plenty of issues that we'd love help with.
JSDoc
support, including typedefs.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.
3.0.0
The largest change to documentation.js so far.
Dropping streams
This a major refactor of the documentation.js interface with a focus on simplifying the system. Up until this point, documentation.js was built around node.js streams, which are low-level representations of asynchronous series of data. While this abstraction was appropriate for the input and github streams, which are asynchronous, the majority of documentation.js's internals are simple and synchronous functions for which basic functional composition makes more sense than stream semantics.
Documentation 3.0.0 uses simple functional composition for operations like parmameter inference, rather than streams.
Stronger support for ES6, ES7, and Flow
We've switched to Babel as our source code parser, which means that we have much broader support of new JavaScript features, including import/export syntax and new features in ES6.
Babel also parses Flow type annotations, and new inference code means that we can infer
Without any explicit JSDoc tags. This means that for many simple functions, we can generate great documentation with less writing.
Stronger module support
Documentation.js now has much better inference for membership and names of symbols
exported via exports
or module.exports
.
Support for nested symbols
The parent/child relationship between symbols is now fully hierarchical, and symbols can be nested to any depth. For instance:
/**
* A global Parent class.
*/
var Parent = function () {};
/**
* A Child class.
*/
Parent.Child = function () {};
/**
* A Grandchild class.
*/
Parent.Child.Grandchild = function () {};
In addition, filtering by access is now applied to the entire hierarchy: if you
mark a class as @private
, neither it nor its children will be included in the
output by default, regardless of the access specifiers of the children.
mdast-based Markdown output
We've switched from templating Markdown output with Handlebars.js to generating an abstract syntax tree of desired output and stringifying it with mdast. This lets documentation.js output complex Markdown without having to worry about escaping and properly formatting certain elements.
Test coverage 100%
documentation.js returns to 100% test coverage, so every single line of code is covered by our large library of text fixtures and specific tests.
--lint mode
Specifying the --lint
flag makes documentation.js check for non-standard
types, like String
, or missing namespaces. If the encountered files have
any problems, it pretty-prints helpful debug messages and exits with status 1,
and otherwise exits with no output and status 0.
Breaking changes
--version
flag is now --project-version
. --version
now outputs
documentation.js's versionFAQs
a documentation generator
The npm package documentation receives a total of 121,977 weekly downloads. As such, documentation popularity was classified as popular.
We found that documentation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.