Skip to content
nodejsPublic

About

Node.js's tooling for API generation

Resources

Code of conduct

Contributing

Security policy

Stars

80 stars

Watchers

29 watching

Forks

Latest commit

Β 

History

898 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation


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
  preview [options]    Serve the generated docs locally, building first when any
                       `generate` option is passed
  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, json-all, json-simple, legacy-html,
                               legacy-html-all, man-page, legacy-json,
                               legacy-json-all, addon-verify, api-links,
                               orama-db, llms-txt, llms-txt-full, sitemap,
                               html, section-pages) 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

preview

To verify the output locally, preview serves it over HTTP. Passing any generate option builds first; otherwise the existing output directory (./out by default) is served as-is, without reading your configuration file. It builds once and doesn't watch for changes, so run it again after editing.

npx @doc-kit/cli preview --host localhost --port 3000
Usage: doc-kit preview [options]

Serve the generated docs locally, building first when any `generate` option is
passed

Options:
  --port <number>              Port to serve on (default: 3000)
  --host <host>                Host to listen on (default: "localhost")
  --config-file <path>         Config file
  -i, --input <patterns...>    Input file patterns (glob)
  -t, --target <generator...>  Target generator(s): a built-in name (json,
                               json-all, json-simple, legacy-html,
                               legacy-html-all, man-page, legacy-json,
                               legacy-json-all, addon-verify, api-links,
                               orama-db, llms-txt, llms-txt-full, sitemap, html,
                               section-pages) 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

Warning

The preview server is meant for local testing only. It is not a secure, production-grade server: don't expose it to other machines. To publish your docs, see Publishing your docs.

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

About

Node.js's tooling for API generation

Resources

Code of conduct

Contributing

Security policy

Stars

80 stars

Watchers

29 watching

Forks

Releases

Used by

Contributors

Languages