Skip to content

Latest commit

 

History

History
124 lines (102 loc) · 4.26 KB

File metadata and controls

124 lines (102 loc) · 4.26 KB


Node.js Logo

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

$ npx @doc-kit/cli --help
Usage: 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: 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, html) 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/cli 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 @doc-kit/generator-react package, which must be installed alongside this one.

npx @doc-kit/cli 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