JavaScript API documentor with simple syntax.
Last updated 4 years ago by vitaly .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install ndoc 
SYNC missed versions from official npm registry.

NDoc - JavaScript documentation generator

Build Status

NDoc is an inline comment parser and JavaScript documentation generator written in Node.JS. This project was inspired by PDoc. It tries to keep compatibility, but has some differences:

  • NDoc is primarily a CLI tool, so you don't need to code your documentor, although it can be easily used as library.
  • Clarified EBNF syntax. Definitions now MUST be separated with an empty line from the following comments.
  • Added options for deprecated tag: you can set versions, when tag was deprecated and when method/property will be removed.
  • Added new tags: read-only, internal, chainable
  • Events support.

How to Install

We suppose that you already have Node and npm installed. If not - try nvm.

npm install -g ndoc


usage: ndoc [-h] [-v] [--exclude PATTERN] [-o PATH] [--use PLUGIN]
            [--alias MAPPING] [-r RENDERER] [--link-format FORMAT]
            [-t TEMPLATE] [--show-all] [--package PACKAGE] [--index FILE]
            [--gh-ribbon URL] [--broken-links ACTION] [--noenv]
            PATH[PATH ...]

Positional arguments:
  PATH                            Source files location

Optional arguments:
  -h, --help                      Show this help message and exit.
  -v, --version                   Show program's version number and exit.
  --exclude PATTERN               Glob patterns of filenames to exclude (you 
                                  can use wildcards: ?, *, **).
  -o PATH, --output PATH          Resulting file(s) location.
  --use PLUGIN                    Load custom plugin.
  --alias MAPPING                 Registers extensions alias. For example 
                                  `cc:js` will register `cc` extension as an 
                                  alias of `js`
  -r RENDERER, --render RENDERER  Documentation renderer (html, json). More 
                                  can be added by custom plugins.
  --link-format FORMAT            View sources link (no links by default) 
                                  format. You can use `{file}` and `{line}` 
                                  and any of `{package.*}` variables for 
  -t TEMPLATE, --title TEMPLATE   Documentation title template. You can use 
                                  any of `{package.*}` variables for 
                                  interpolation. DEFAULT: `{package.name} 
                                  {package.version} API documentation`
  --show-all                      By default `internal` methods/properties 
                                  are not shown. This trigger makes ndoc show 
                                  all methods/properties
  --package PACKAGE               Read specified package.json FILE. When not 
                                  specified, read ./package.json if such file 
  --index FILE                    Index file (with introduction text), e.g. 
                                  README.md file.
  --gh-ribbon URL                 Add "Fork me on GitHub" ribbon with given 
                                  URL. You can use any of `{package.*}` 
                                  variables for interpolation.
  --broken-links ACTION           What to do if broken link occurred (show, 
                                  hide, throw). DEFAULT: `show`.
  --noenv                         Ignore .ndocrc


NDoc Syntax. It is similar to PDoc one, with some extentions (see start of this doc for details).

For developers

You can generate prototype documentation for test:

make test

Then open ./tests/prototype-doc/index.html. Here is hosted example.

Custom parsers and renderers

You can create and use your own parser/renderer via --use option. Get one of the parsers or renderers as a base template, copy it into separate folder. Create package.json and modify it to fit your needs. Then attach it with --use my-module argument.

Using NDoc as module

You can use NDoc as module, for example, to override default options processing.

var NDoc = require('ndoc');

var options = {
  linkFormat  : 'http://example.com/{file}#{line}',
  output:     : 'doc'

var ast;

try {
  ast = NDoc.parse(['lib/my-module.js'], options);
} catch (err) {

try {
  NDoc.render('html', ast, options);
} catch (err) {


This project is distributed under MIT license.

Current Tags

  • 5.0.1                                ...           latest (4 years ago)

22 Versions

  • 5.0.1                                ...           4 years ago
  • 5.0.0                                ...           4 years ago
  • 4.0.1                                ...           5 years ago
  • 4.0.0                                ...           5 years ago
  • 3.1.0                                ...           7 years ago
  • 3.0.1                                ...           7 years ago
  • 3.0.0                                ...           7 years ago
  • 2.0.5                                ...           8 years ago
  • 2.0.4                                ...           8 years ago
  • 2.0.3                                ...           8 years ago
  • 2.0.2                                ...           8 years ago
  • 2.0.1                                ...           8 years ago
  • 2.0.0                                ...           8 years ago
  • 1.0.7                                ...           9 years ago
  • 1.0.6                                ...           9 years ago
  • 1.0.5                                ...           9 years ago
  • 1.0.4                                ...           9 years ago
  • 1.0.3                                ...           9 years ago
  • 1.0.2                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
Maintainers (1)
Today 0
This Week 0
This Month 3
Last Day 0
Last Week 1
Last Month 59
Dependencies (11)
Dev Dependencies (2)

Copyright 2014 - 2017 © taobao.org |