‹ 首页

documenter-vitepress

@juliagenai · 收录于 1 周前

Use 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.

适合你,如果正在用 Julia 写文档并想快速预览效果

/ 下载安装
documenter-vitepress.skill双击,或拖进 Claude 桌面版 / Cowork,即完成安装↓ .skill↓ .zip
用别的 agent?下载 .zip 解压,把文件夹放进它的技能目录
Claude Code~/.claude/skills/(项目级 .claude/skills/)
Codex CLI~/.codex/skills/
Cursor自动读取上面两处目录
其他工具见其文档的「skills」目录;两个下载是同一份文件,只是名字不同
/ 通过 npx 安装 校验哈希
npx oh-my-skill add juliagenai/julia-agent-skills/documenter-vitepress
/ 通过 bash 安装
curl -fsSL https://oh-my-skill.com/install.sh | bash -s -- juliagenai/julia-agent-skills/documenter-vitepress
/ 已经装过?验证本机副本,不用重装
npx oh-my-skill verify juliagenai/julia-agent-skills/documenter-vitepress
安装目标可用 --agent / --scope 或 --to 明确指定;省略时只会在唯一已存在的 agent 目录上自动选择,零命中或多命中会停止并提示。content_hash 缺失或不一致均拒装。
27GitHub stars
~1K最小装载
~1.8K含声明引用
~1.8K文本包总量
镜像托管

怎么用

技能原文 SKILL.md作者撰写 · MIT · 0b9bbcc

DocumenterVitepress.jl

DocumenterVitepress.jl builds Julia docs using Documenter.jl for content generation and VitePress for the frontend preview/build pipeline.

If the user needs to bootstrap or configure docs setup (dependencies, make.jl, CI, .gitignore, layout templates), refer to references/setup-reference.md.

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.

Local Development Workflow

This skill focuses on the day-to-day local iteration loop after setup already exists.

The fast loop has two stages:

  1. Run makedocs to regenerate build/.documenter/ content from src/.
  2. Run VitePress dev server via dev_docs to preview.
Step 1: Set build_vitepress = false in make.jl
format = DocumenterVitepress.MarkdownVitepress(
    # ... other options ...
    build_vitepress = false,
),

This makes makedocs emit markdown artifacts only, without running the full VitePress build.

Step 2: Run makedocs
include("make.jl")

Or from shell:

  • Standalone docs repo: julia --project=. -e 'include("make.jl")'
  • Package docs in docs/: julia --project=docs -e 'include("docs/make.jl")'
Step 3: Start the dev server (background process)

dev_docs is a long-running process and blocks the current task/thread. Start it in a non-blocking way:

From shell (be sure to run this in the background):

julia --project=. -e 'using DocumenterVitepress; DocumenterVitepress.dev_docs("build")'

From Julia REPL / MCP tool:

using DocumenterVitepress
Threads.@spawn DocumenterVitepress.dev_docs("build")

For package repos where docs live under docs/, use "docs/build" instead of "build".

The server starts at http://localhost:SOMEPORT/ with hot reload. The port number is reported in the output of the command.

Gotcha: dev_docs expects the build directory path (for example, build), not build/.documenter. It appends /.documenter internally.

Step 4: Edit-rebuild-preview cycle
  1. Edit files in src/
  2. Re-run include("make.jl")
  3. If the generated content changed but the browser did not update, restart dev_docs
  4. Confirm changes in browser
Teardown

Before committing, remove build_vitepress = false (or set it to true) so CI and release builds run the full pipeline.

Workflow-Specific Gotchas
npm install ownership (DV-managed vs self-managed)

npm install behavior depends on who owns package.json:

  • 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.
  • 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.

Rule of thumb: no custom package.json means DV manages npm; custom package.json means you manage npm.

Custom .vitepress/ theme files

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.

deploydocs must use DocumenterVitepress.deploydocs

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.

Manual rebuild expectation

DocumenterVitepress does not continuously re-run makedocs. After content changes, re-run make.jl and keep dev_docs running for browser-side hot reload.

Customizing the theme or adding Vue components

If you add custom Vue components or theme overrides, keep the full required theme set present:

  • src/.vitepress/theme/index.ts — theme entry point that registers Vue components
  • src/.vitepress/theme/style.css — custom CSS
  • src/.vitepress/theme/docstrings.css — docstring block styling

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.

Start from the project's working defaults and then modify. Ensure index.ts imports and registers any custom components.

For first-time setup patterns and templates, use references/setup-reference.md.

按 MIT 许可原样转载,未经改动 · 在 GitHub 查看 →

评论

登录即可评论;带「已验证安装」的,是发布者名下有本店的安装或持有记录。