Skip to content

Repository files navigation


Node.js Logo

@nodejs/doc-kit is a tool to generate API documentation of Node.js. See this issue for more information.

doc-kit can make sites unrelated to Node.js too. View the docs, getting-started, and showcase.

MIT License Codecov coverage badge doc-kit scorecard badge CII Best Practices badge

Usage

Local invocation:

$ npx doc-kit --help
$ node packages/core/bin/cli.mjs --help
Usage: @nodejs/doc-kit [options] [command]

CLI tool to generate the Node.js API documentation

Options:
  --log-level <level>  Log level (choices: "debug", "info", "warn", "error",
                       "fatal", default: "info")
  -h, --help           display help for command

Commands:
  generate [options]   Generate API docs
  help [command]       display help for command

generate

You must provide an input and at least one target through command-line options or a configuration file. Configuration is discovered automatically using cosmiconfig, or you can select a file explicitly with --config-file. Running generate without the required values exits with an error pointing you to the help output.

Usage: @nodejs/doc-kit generate [options]

Generate API docs

Options:
  --config-file <path>         Config file
  -i, --input <patterns...>    Input file patterns (glob)
  -t, --target <generator...>  Target generator(s): a built-in name
                               (json-simple, legacy-html, legacy-html-all,
                               man-page, legacy-json, legacy-json-all,
                               addon-verify, api-links, orama-db, llms-txt,
                               sitemap, web) or an import specifier for a custom
                               generator
  --ignore <patterns...>       Ignore file patterns (glob)
  -o, --output <directory>     The output directory
  -p, --threads <number>       Number of threads to use (minimum: 1)
  --chunk-size <number>        Number of items to process per worker thread
                               (minimum: 1)
  -v, --version <semver>       Target Node.js version
  -c, --changelog <url>        Changelog URL or path
  --git-ref <ref>              Git ref
  --index <url>                index.md URL or path
  --minify                     Minify?
  --type-map <url>             Type map URL or path
  -h, --help                   display help for command

Examples

Legacy

To generate a 1:1 match with the legacy tooling, use the legacy-html, legacy-json, legacy-html-all, and legacy-json-all generators.

npx doc-kit generate \
  -t legacy-html \
  -t legacy-json \
  -i "path/to/node/doc/api/*.md" \
  -o out \
  --index path/to/node/doc/api/index.md

Redesigned

To generate our redesigned documentation pages, use the html and orama-db (for search) generators. These generators live in the separate @nodejs/doc-kit-generator-react package, which must be installed alongside this one.

npx doc-kit generate \
  -t html \
  -t orama-db \
  -i "path/to/node/doc/api/*.md" \
  -o out \
  --index path/to/node/doc/api/index.md

Tip

In order to use the search functionality, you must serve the output directory.

npx serve out

About

Node.js's tooling for API generation

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

Used by

Contributors

Languages