On this page
Generated Docs
Some pages are best written by a tool: the API reference of a library, from its code and comments, or a list of command line options. generate in clay.yaml runs such tools before every clay build, clay dev and clay check, so the generated pages are always up to date and part of the site like any other.
generate:
- npx typedoc --plugin typedoc-plugin-markdown --entryFileName index --out docs/api src/index.tsThe commands run in the project folder, one after another. Whatever they write into docs/ becomes pages: in the navigation, the search, the link checks and the Markdown for agents.
Tip
This site generates its CLI reference from Clay’s own help, with a script of a few lines: scripts/cli-reference.mjs.
#API reference from code
Any tool that writes Markdown works:
TypeDoc with typedoc-plugin-markdown:
generate:
- npx typedoc --plugin typedoc-plugin-markdown --entryFileName index --out docs/api src/index.tsgenerate:
- gomarkdoc --output docs/api/index.md ./...generate:
- pydoc-markdown -I src -m my_package > docs/api.mdKeep generated pages out of git. They are written fresh on every build:
.gitignoredocs/api/in
.gitignore.Install the tool in CI too, before
npx clay build --strict: as a dev dependency inpackage.json, or with a step of its own.Write around it. An
index.mdin the folder gives the generated pages a title, an icon and an introduction, as long as the tool does not write one itself. See index pages.
#When a command fails
The build stops and shows the command’s last lines:
clay check --json reports the same lines as problems.
Note
The commands in clay.yaml run on every machine that builds the docs, like the scripts in package.json. Review changes to them like code.