API documentation
Write generated API pages under content/api-references/. Docskit renders these
files with the same Markdown pipeline as your guides and gives them a separate
sidebar and route prefix.
Generate the content
Run your API generator before starting or building the docs. Its output should
include YAML frontmatter with title and description on every page:
---
title: API reference
description: Functions and types exposed by My Project.
---
# API reference
Choose a module from the sidebar.
That file supplies /api-references/. A file such as
content/api-references/client.md supplies /api-references/client/.
Docskit consumes the generated Markdown. Run any Python, Rust, Zig, or other language tooling in your generation step before invoking Docskit. The renderer does not run those toolchains for you.
Add API navigation
Set apiNavigation in docskit.config.ts. The links must match generated pages:
apiNavigation: [
{
label: "API reference",
items: [
{ label: "Overview", href: "/api-references/" },
{ label: "Client", href: "/api-references/client/" },
],
},
],
With the default navbar, a nonempty apiNavigation array adds an API references
tab. If you configure links yourself, include an API link in that array too.
Without an API content directory, the CLI omits the API routes.
Generate before each docs command
Add your generator to your project's scripts before docskit dev,
docskit check, and docskit build. This keeps page content and navigation in
step. Generate a navigation module alongside the pages when your API has enough
modules that maintaining links by hand would duplicate the generator's output.
In this repository, packages/docs/generate-api.mjs uses TypeDoc and
typedoc-plugin-markdown. It generates Markdown pages and an API navigation module
from the package's public TypeScript entry points. Run it from the repository root:
pnpm docs:api
The current API is labeled Next (unreleased). The docs workspace's snapshot script
runs its generator with --release to capture the numeric package version.
Freeze API pages with a release
Generate the API for the release before taking a docs snapshot. The snapshot
copies generated pages and API navigation together, so an older release keeps its
own signatures and module list. The version selector shows the most recently
promoted release in each docs line, rather than every patch release. Keep current generated pages in content/ and
follow Versioning to publish snapshots.
The package exports guide explains Docskit's supported imports. The generated API reference contains their signatures.