On this page

The Node.js-specific parts of doc-kit: three generators for outputs only the Node.js project needs (its man page, apilinks.json and its addon example tests), and @node-core/doc-kit/config, a preset that configures the general-purpose generators the way nodejs.org builds its API documentation.

Use it to build the Node.js API documentation, or documentation shaped like it. Other projects don't need it: doc-kit's defaults are project-neutral, so start from Getting started.

That covers the three generators. To build the website, the search index, llms.txt or the sitemap with the preset, also install the generators that make them:

The CLI loads each target name from this package: man-page loads @node-core/doc-kit/man-page.

TargetInput in Node.jsOutput
man-pagedoc/api/cli.mdnode.1, the node man page in mdoc format, with the options and environment variables that cli.md documents
api-linkslib/*.jsapilinks.json, which maps each API (such as buffer.Buffer) to the line on GitHub that defines it
addon-verifydoc/api/addons.mdA folder per addon example (such as 02_function_arguments/), with its C++ and JavaScript files and a binding.gyp

From the root of a Node.js checkout:

npx doc-kit generate -t man-page -i doc/api/cli.md -o out
npx doc-kit generate -t api-links -i "lib/*.js" -o out
npx doc-kit generate -t addon-verify -i doc/api/addons.md -o out/addons
Important

api-links builds its URLs from the repository and ref options. doc-kit sets no repository by default, so without one the URLs keep a literal {repository}. Extend the preset, which sets nodejs/node, or set global.repository in your configuration. Pass --git-ref to link to a tag or commit instead of HEAD.

@node-core/doc-kit/config gives the project-neutral generators Node.js branding, URL layouts and release history. Extend it from your configuration file:

export default {
  extends: '@node-core/doc-kit/config',

  target: ['html', 'orama-db'],
  global: {
    input: ['doc/api/*.md'],
    output: 'out',
  },
};

The preset doesn't choose targets or inputs. It sets these options:

OptionValue
global.projectNode.js
global.repository, global.refnodejs/node, HEAD
global.baseURLhttps://nodejs.org/docs
global.changeloghttps://raw.githubusercontent.com/nodejs/node/HEAD/CHANGELOG.md, the release history
html.editURLhttps://github.com/{repository}/edit/{ref}/doc/api{path}.md
html.pageURL{baseURL}/latest-{version}/api{path}.html
html.remoteConfigUrlhttps://nodejs.org/site.json, which the browser fetches for banners and the release list
html.headThe Node.js description, Open Graph tags and favicon
html.stylesheetsA theme with the Node.js green brand colors
html.importsThe Node.js logo as #theme/Logo
llms-txt.templatePath, llms-txt.pageURLA Node.js llms.txt header, and {baseURL}/latest/api{path}.md
sitemap.indexURL, sitemap.pageURL{baseURL}/latest/api/, {baseURL}/latest/api{path}.html

See Website, llms.txt and Sitemap for what each option does.

Tip

With the preset, every run downloads the release history from GitHub. To build offline, pass a local copy instead, such as --changelog CHANGELOG.md from the root of a Node.js checkout.

Your configuration file wins over the preset. Objects merge key by key, but an array you set (such as html.stylesheets or html.head.meta) replaces the preset's instead of adding to it (see Precedence). To keep the Node.js theme and add a stylesheet of your own, spread the preset's value:

import { join } from 'node:path';

import preset from '@node-core/doc-kit/config';

export default {
  extends: '@node-core/doc-kit/config',

  html: {
    stylesheets: [
      ...preset.html.stylesheets,
      join(import.meta.dirname, 'extra.css'),
    ],
  },
};