$npx -y skills add JuliaGenAI/julia-agent-skills --skill documenter-vitepressUse when setting up or developing a Julia based documentation site with DocumenterVitepress.jl. Also use when the user mentions DocumenterVitepress, VitePress for Julia docs, or wants to preview docs locally with hot reload.
| 1 | # DocumenterVitepress.jl |
| 2 | |
| 3 | DocumenterVitepress.jl builds Julia docs using Documenter.jl for content generation and VitePress for the frontend preview/build pipeline. |
| 4 | |
| 5 | If the user needs to bootstrap or configure docs setup (dependencies, `make.jl`, CI, `.gitignore`, layout templates), refer to `references/setup-reference.md`. |
| 6 | |
| 7 | Always mention to the user that **they can ask you to render the documentation for them**, since the process is a bit complex. But if they ask the process feel free to explain. |
| 8 | |
| 9 | ## Local Development Workflow |
| 10 | |
| 11 | This skill focuses on the day-to-day local iteration loop after setup already exists. |
| 12 | |
| 13 | The fast loop has two stages: |
| 14 | |
| 15 | 1. Run `makedocs` to regenerate `build/.documenter/` content from `src/`. |
| 16 | 2. Run VitePress dev server via `dev_docs` to preview. |
| 17 | |
| 18 | ### Step 1: Set `build_vitepress = false` in make.jl |
| 19 | |
| 20 | ```julia |
| 21 | format = DocumenterVitepress.MarkdownVitepress( |
| 22 | # ... other options ... |
| 23 | build_vitepress = false, |
| 24 | ), |
| 25 | ``` |
| 26 | |
| 27 | This makes `makedocs` emit markdown artifacts only, without running the full VitePress build. |
| 28 | |
| 29 | ### Step 2: Run makedocs |
| 30 | |
| 31 | ```julia |
| 32 | include("make.jl") |
| 33 | ``` |
| 34 | |
| 35 | Or from shell: |
| 36 | |
| 37 | - Standalone docs repo: `julia --project=. -e 'include("make.jl")'` |
| 38 | - Package docs in `docs/`: `julia --project=docs -e 'include("docs/make.jl")'` |
| 39 | |
| 40 | ### Step 3: Start the dev server (background process) |
| 41 | |
| 42 | `dev_docs` is a long-running process and blocks the current task/thread. Start it in a non-blocking way: |
| 43 | |
| 44 | From shell (be sure to run this in the background): |
| 45 | |
| 46 | ```bash |
| 47 | julia --project=. -e 'using DocumenterVitepress; DocumenterVitepress.dev_docs("build")' |
| 48 | ``` |
| 49 | |
| 50 | From Julia REPL / MCP tool: |
| 51 | |
| 52 | ```julia |
| 53 | using DocumenterVitepress |
| 54 | Threads.@spawn DocumenterVitepress.dev_docs("build") |
| 55 | ``` |
| 56 | |
| 57 | For package repos where docs live under `docs/`, use `"docs/build"` instead of `"build"`. |
| 58 | |
| 59 | The server starts at `http://localhost:SOMEPORT/` with hot reload. The port number is reported in the output of the command. |
| 60 | |
| 61 | Gotcha: `dev_docs` expects the build directory path (for example, `build`), not `build/.documenter`. It appends `/.documenter` internally. |
| 62 | |
| 63 | ### Step 4: Edit-rebuild-preview cycle |
| 64 | |
| 65 | 1. Edit files in `src/` |
| 66 | 2. Re-run `include("make.jl")` |
| 67 | 3. If the generated content changed but the browser did not update, restart `dev_docs` |
| 68 | 4. Confirm changes in browser |
| 69 | |
| 70 | ### Teardown |
| 71 | |
| 72 | Before committing, remove `build_vitepress = false` (or set it to `true`) so CI and release builds run the full pipeline. |
| 73 | |
| 74 | ## Workflow-Specific Gotchas |
| 75 | |
| 76 | ### npm install ownership (DV-managed vs self-managed) |
| 77 | |
| 78 | `npm install` behavior depends on who owns `package.json`: |
| 79 | |
| 80 | - **DV-managed npm (default):** If you do **not** provide your own `package.json`, DocumenterVitepress supplies defaults and manages npm dependencies for you during local docs flows. |
| 81 | - **Self-managed npm:** If the repo provides a custom `package.json`, you own npm dependency management. Run `npm install` yourself (especially after dependency changes or lockfile updates) before `dev_docs` or local builds. |
| 82 | |
| 83 | Rule of thumb: no custom `package.json` means DV manages npm; custom `package.json` means you manage npm. |
| 84 | |
| 85 | ### Custom `.vitepress/` theme files |
| 86 | |
| 87 | If the repo overrides theme files, keep them in sync with the DocumenterVitepress version used by the project. Breakage here usually shows up during local preview first. |
| 88 | |
| 89 | ### `deploydocs` must use `DocumenterVitepress.deploydocs` |
| 90 | |
| 91 | In `make.jl`, always call `DocumenterVitepress.deploydocs(...)` instead of `Documenter.deploydocs(...)`. The DocumenterVitepress version handles the VitePress build artifacts correctly for deployment. Using the plain `Documenter.deploydocs` will not deploy the VitePress-generated site. |
| 92 | |
| 93 | ### Manual rebuild expectation |
| 94 | |
| 95 | DocumenterVitepress does not continuously re-run `makedocs`. After content changes, re-run `make.jl` and keep `dev_docs` running for browser-side hot reload. |
| 96 | |
| 97 | ### Customizing the theme or adding Vue components |
| 98 | |
| 99 | If you add custom Vue components or theme overrides, keep the full required theme set present: |
| 100 | |
| 101 | - `src/.vitepress/theme/index.ts` — theme entry point that registers Vue components |
| 102 | - `src/.vitepress/theme/style.css` — custom CSS |
| 103 | - `src/.vitepress/theme/docstrings.css` — docstring block styling |
| 104 | |
| 105 | You can populate all pre-generated Vitepress files by invoking `DocumenterVitepress.generate_template("MyPackage/docs", "MyPackage")`. Delete everything you do not want to override / customize. |
| 106 | |
| 107 | Start from the project's working defaults and then modify. Ensure `index.ts` imports and registers any custom components. |
| 108 | |
| 109 | For first-time setup patterns and templates, use `references/setup-reference.md`. |