- ❌ 定制能力弱,难以实现现代化仪表板
- ❌ 主题风格受限,违和感重
- ❌ Python 生态,前端能力有限
- ✅ 现代设计,默认主题就很美观
- ✅ Vue 3 驱动,支持自定义组件
- ✅ 极速加载 (Vite 构建)
- ✅ 中文文档完善
- ✅ 更好的响应式设计
# 使用 nvm (推荐)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 18
nvm use 18
# 或使用系统包管理器
# Ubuntu/Debian
sudo apt install nodejs npm
# macOS
brew install nodecd skillpi
npm install# 启动开发服务器
npm run dev
# 访问 http://localhost:5173# 构建静态站点
npm run build
# 预览构建结果
npm run previewskillpi/
├── docs/ # 文档目录
│ ├── .vitepress/ # VitePress 配置
│ │ └── config.ts # 配置文件
│ ├── public/ # 静态资源
│ │ └── hero.svg # Logo
│ ├── guide/ # 指南
│ ├── skills/ # 技能文档
│ ├── index.md # 主页
│ └── about.md # 关于
├── package.json # Node.js 配置
├── src/skillpi/ # Python 代码 (保留)
└── scripts/ # Python 脚本 (保留)
export default defineConfig({
title: 'SkillPI',
description: 'Skill Catalogue for Microbiome Informatics Study',
themeConfig: {
nav: [
{ text: '首页', link: '/' },
{ text: '工具', link: '/skills/tools' },
// ...
],
sidebar: {
'/skills/': [
// 侧边栏配置
]
}
}
})使用 VitePress 的 frontmatter 配置:
---
layout: home
title: SkillPI
hero:
name: SkillPI
text: 微生物组信息学技能目录
tagline: Exploring the Human Microbiome
actions:
- theme: brand
text: 开始使用
link: /skills/tools
---VitePress 提供 CSS 变量:
/* 颜色 */
--vp-c-brand /* 主色调 */
--vp-c-bg /* 背景色 */
--vp-c-text-1 /* 主文字 */
--vp-c-text-2 /* 次要文字 */
/* 阴影 */
--vp-shadow-2
--vp-shadow-4在 Markdown 中使用 <style> 标签:
<style>
.dashboard-section {
padding: 4rem 2rem;
background: var(--vp-c-bg-soft);
}
</style>| 特性 | MkDocs | VitePress |
|---|---|---|
| 加载速度 | 慢 | 极快 ⚡ |
| 定制能力 | 弱 | 强 ✅ |
| 设计现代感 | 一般 | 优秀 ✨ |
| 学习曲线 | 低 | 中等 |
| 生态 | Python | Node.js/Vue |
{
"scripts": {
"docs:build": "vitepress build docs",
"docs:deploy": "npm run docs:build && npx gh-pages -d docs/.vitepress/dist"
}
}npm install --save-dev gh-pagesnpm run docs:deploy创建 .github/workflows/deploy.yml:
name: Deploy Docs
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install dependencies
run: npm install
- name: Build
run: npm run build
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: docs/.vitepress/dist# 开发
npm run dev # 启动开发服务器
# 构建
npm run build # 构建生产版本
npm run preview # 预览构建结果
# 部署
npm run docs:deploy # 部署到 GitHub PagesSkillPI 的 Python 代码(爬虫、CLI 等)仍然保留:
src/skillpi/- Python 包scripts/- Python 脚本data/- 数据文件
原有 MkDocs 文档需要转换为 VitePress 格式:
- Frontmatter 语法略有不同
- 导航配置在 config.ts 中
- 支持 Markdown + Vue 组件
- Node.js 依赖:
package.json - Python 依赖:
pyproject.toml(保留)
- ✅ 安装依赖 -
npm install - ✅ 本地测试 -
npm run dev - ✅ 自定义主题 - 修改 config.ts
- ✅ 添加内容 - 编写 Markdown
- ✅ 部署上线 -
npm run build
迁移完成时间: 2026-03-18
状态: ✅ 已完成
Git Commit: 46e16ce