Imported from can-dy-jack/ts-mkdocs (
AGENTS.md). Install upstream withnpx skills add can-dy-jack/ts-mkdocs. Copyright stays with the author.
ts-mkdocs — Agent Notes
Monorepo basics
- Package manager: pnpm 9 (enforced via
packageManagerfield). Do not use npm or yarn. - Workspace: Two packages under
packages/:core/— build engine + CLI (package namets-mkdocs)theme-material/— Nunjucks templates + static assets (package namets-mkdocs-theme-material)
Build & dev
pnpm install→pnpm buildis the required first setup.pnpm buildat root runstsupinpackages/coreonly.theme-materialhas no build step; templates and assets are consumed from source.pnpm devrunstsup --watchin parallel across packages.pnpm typecheckrunstsc --noEmitacross packages.pnpm testruns Vitest unit tests inpackages/core.
Running the example site
The example site validates changes end-to-end. You must build first because the scripts reference compiled output:
pnpm example:build— runsnode packages/core/dist/cli.js build -f example/ts-mkdocs.ymlpnpm example:serve— runsnode packages/core/dist/cli.js serve -f example/ts-mkdocs.yml
Architecture gotchas
- ESM only.
tsupoutputsesm, targetnode20. All source uses.jsextensions in imports. - Dynamic theme resolution.
build.tsloads the theme at runtime viaawait import('ts-mkdocs-theme-material'). The core package depends on the theme viaworkspace:*. - Feature flags.
theme.featuresints-mkdocs.ymldrives UI behavior viafeatures.ts→ template context +material.js. - Markdown extensions. Configured via
markdown_extensionsints-mkdocs.yml, applied inmarkdown-extensions.ts. - Plugins. Built-in plugins in
packages/core/src/plugins/. External plugins viats-mkdocs-plugin-<name>npm packages. - Live reload uses SSE, not WebSocket (
/__livereloadendpoint). - Default config behavior:
use_directory_urlsdefaults totrue, so pages output aspath/index.htmlrather thanpath.html.
Entry points
- CLI commands live in
packages/core/src/cli.ts(built todist/cli.js). - Public API is exported from
packages/core/src/index.ts(built todist/index.js). - Theme paths are exported from
packages/theme-material/index.js(templatesDir,assetsDir).
Important paths
- Example config:
example/ts-mkdocs.yml - Example docs source:
example/docs/ - Example build output:
example/site/(gitignored)