Contributing Docs
This page explains where to put docs and what your changes do in the site UI.
Run docs commands from the monorepo root (the folder that contains package.json).
Where to write docs
Keep docs beside the code they describe:
- Plugin docs:
plugins/<plugin-slug>/docs/ - Theme docs:
themes/<theme-slug>/docs/
Minimum per package:
index.md(required)- Optional extra pages such as
usage.md,faq.md,api.md
Example:
text
plugins/example-plugin/
docs/
index.md
usage.mdWhat changes appear where
- Add
docs/index.mdin a plugin or theme -> package appears in the left sidebar underPluginsorThemes. - Add another markdown file (example
usage.md) -> creates another page route for that package. - Add a heading like
## Setupin a page -> appears in the right-side "On this page" links asSetup. - Rename a heading -> right-side "On this page" link text also changes.
- Remove a heading -> its right-side link disappears.
Note: only headings in page content (##, ###, etc.) create "On this page" links. A normal bold line is not a heading.
Do not edit generated docs
docs/content/ is generated output. Do not edit files there directly because they are replaced during sync.
How docs:sync works
pnpm docs:sync runs tools/sync-docs.mjs.
It:
- deletes
docs/content/(generated output) - recreates
docs/content/ - copies package docs from:
plugins/<slug>/docs/**->docs/content/plugins/<slug>/themes/<slug>/docs/**->docs/content/themes/<slug>/
Why this exists:
- The VitePress-based site builds from
docs/ - package docs are owned inside package folders
- sync combines both into one build input
Safe workflow (step-by-step)
- Edit docs only in
plugins/.../docsorthemes/.../docs - Start docs:
pnpm docs:dev(runs sync once on start, then re-runs sync whenplugins/**/docs/**,themes/**/docs/**, ortools/sync-docs.mjschanges) - Check your package in the left sidebar
- Open your page and check right-side "On this page" links
- Commit source docs only (not generated
docs/content)