Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

128 lines (92 sloc) 5.097 kb

NDoc - JavaScript documentation generator

Build Status

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

  • NDoc is a CLI tool, not library. It doesn't require additional programming to execute.
  • 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 it will be removed.
  • Added new tags: read-only, internal, chainable
  • Events support.

How to Install

We suppose that you already have node.js and npm installed. If not - try nvm. Then install NDoc globally

npm install -g ndoc


usage: ndoc [-h] [-v] [--exclude PATTERN] [-o PATH] [--use PLUGIN]
            [-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               Pathnames to exclude. Pathnames might be 
                                  absolute or relative and might have 
                                  wildcards: - `*` Matches single directory 
                                  or file: /foo/* matches /foo/bar but not 
                                  /foo/bar/baz - `**` Matches files and 
                                  directries recursively: /foo** matches 
                                  /foo/bar, /foo/bar/baz, etc. - `?` Matches 
                                  exactly one non-slash character
  -o PATH, --output PATH          Resulting file(s) location
  --use PLUGIN                    Use custom plugin
  -r RENDERER, --render RENDERER  Documentation renderer
  --link-format FORMAT            Format for link to source file. This can 
                                  have variables: - {file} - Current file - 
                                  {line} - Current line - {package.*} - Any 
                                  package.json variable
  -t TEMPLATE, --title TEMPLATE   Documentation title template. You can use 
                                  any of `{package.*}` variables for 
                                  interpolation, e.g.: `My App {package.
  --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.
  --index FILE                    Index file
  --gh-ribbon URL                 Add "Fork me on GitHub" ribbon with given 
                                  URL. You can use `{package.*}` variables 
  --broken-links ACTION           What to do if broken link occurred
  --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 doc 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  : '{file}#{line}',
  output:     : 'doc'

NDoc.parse(['lib/my-module.js'], options, function (err, ast) {
  if (err) {

  NDoc.render('html', ast, options, function (err) {
    if (err) {


This project is distributed under MIT license.

Jump to Line
Something went wrong with that request. Please try again.