Skip to content

Commit 9cb27a7

Browse files
author
shijiashuai
committed
feat: implement state-of-the-art GitHub Pages with VitePress
Complete overhaul of documentation site using VitePress for modern, high-performance documentation: - Add VitePress configuration with bilingual support (en/zh-CN) - Create custom modern dark theme with CSS variables - Build HomeHero and HomeFeatures Vue components - Add comprehensive GitHub Actions workflow for automated builds - Integrate Doxygen (C++ API) and Sphinx (Python API) outputs - Create bilingual documentation structure - Add package.json for Node.js dependency management - Implement modern navigation, search, and responsive design The new site features: - Modern dark theme optimized for technical documentation - Full-text search across all documentation - Bilingual support with seamless language switching - Responsive design for all devices - Fast performance with Vite-powered builds - Auto-generated API documentation integration Documentation site will be available at: https://lessup.github.io/hpc-ai-optimization-lab/ BREAKING CHANGE: Documentation structure changed from static HTML to VitePress-powered Vue application.
1 parent f1add33 commit 9cb27a7

25 files changed

Lines changed: 2333 additions & 145 deletions

.github/workflows/pages.yml

Lines changed: 211 additions & 145 deletions
Large diffs are not rendered by default.

docs/.vitepress/config.mts

Lines changed: 171 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,171 @@
1+
import { defineConfig } from 'vitepress'
2+
import { head, nav, sidebar, search } from './configs'
3+
4+
// https://vitepress.dev/reference/site-config
5+
export default defineConfig({
6+
// 站点元数据
7+
lang: 'en-US',
8+
title: 'HPC-AI-Optimization-Lab',
9+
titleTemplate: ':title | HPC-AI-Optimization-Lab',
10+
description: 'A comprehensive CUDA kernel optimization laboratory for AI workloads',
11+
12+
// 基础配置
13+
srcDir: '.',
14+
srcExclude: ['**/README.md', '**/node_modules/**'],
15+
outDir: './.vitepress/dist',
16+
cacheDir: './.vitepress/cache',
17+
18+
// 清理 URL
19+
cleanUrls: true,
20+
21+
// 最后更新时间
22+
lastUpdated: true,
23+
24+
// 多语言配置
25+
locales: {
26+
root: {
27+
label: 'English',
28+
lang: 'en-US',
29+
link: '/en/',
30+
...require('./configs/en.mts').default
31+
},
32+
'zh-CN': {
33+
label: '简体中文',
34+
lang: 'zh-CN',
35+
link: '/zh-CN/',
36+
...require('./configs/zh-CN.mts').default
37+
}
38+
},
39+
40+
// Head 配置
41+
head: head(),
42+
43+
// 主题配置
44+
themeConfig: {
45+
// Logo
46+
logo: { src: '/logo.svg', width: 24, height: 24 },
47+
48+
// 站点标题
49+
siteTitle: 'HPC-AI-Lab',
50+
51+
// 导航栏
52+
nav: nav(),
53+
54+
// 侧边栏
55+
sidebar: sidebar(),
56+
57+
// 搜索配置
58+
search: search(),
59+
60+
// 社交链接
61+
socialLinks: [
62+
{ icon: 'github', link: 'https://github.com/LessUp/hpc-ai-optimization-lab' }
63+
],
64+
65+
// 编辑链接
66+
editLink: {
67+
pattern: 'https://github.com/LessUp/hpc-ai-optimization-lab/edit/main/docs/:path',
68+
text: 'Edit this page on GitHub'
69+
},
70+
71+
// 页脚
72+
footer: {
73+
message: 'Released under the Apache 2.0 License.',
74+
copyright: 'Copyright © 2024-2026 HPC-AI-Optimization-Lab Contributors'
75+
},
76+
77+
// 广告
78+
carbonAds: undefined,
79+
80+
// 文档页脚
81+
docFooter: {
82+
prev: 'Previous page',
83+
next: 'Next page'
84+
},
85+
86+
// 大纲
87+
outline: {
88+
label: 'On this page',
89+
level: [2, 4]
90+
},
91+
92+
// 最后更新时间文本
93+
lastUpdated: {
94+
text: 'Last updated',
95+
formatOptions: {
96+
dateStyle: 'full',
97+
timeStyle: 'medium'
98+
}
99+
},
100+
101+
// 返回顶部
102+
returnToTopLabel: 'Return to top',
103+
104+
// 菜单
105+
sidebarMenuLabel: 'Menu',
106+
langMenuLabel: 'Change language',
107+
108+
// 暗色模式
109+
darkModeSwitchLabel: 'Appearance',
110+
lightModeSwitchTitle: 'Switch to light theme',
111+
darkModeSwitchTitle: 'Switch to dark theme',
112+
113+
// 外部链接图标
114+
externalLinkIcon: true
115+
},
116+
117+
// Markdown 配置
118+
markdown: {
119+
theme: {
120+
light: 'github-light',
121+
dark: 'github-dark'
122+
},
123+
lineNumbers: true,
124+
config: (md) => {
125+
// 自定义 Markdown 插件
126+
md.use(require('markdown-it-footnote'))
127+
md.use(require('markdown-it-task-lists'))
128+
}
129+
},
130+
131+
// Vite 配置
132+
vite: {
133+
server: {
134+
port: 5173,
135+
host: true
136+
},
137+
build: {
138+
chunkSizeWarningLimit: 1000,
139+
rollupOptions: {
140+
output: {
141+
manualChunks: {
142+
'group-zh': [
143+
'./configs/zh-CN.mts'
144+
]
145+
}
146+
}
147+
}
148+
},
149+
ssr: {
150+
noExternal: [
151+
'@vitepress-demo-preview/component',
152+
'@vitepress-demo-preview/plugin'
153+
]
154+
},
155+
resolve: {
156+
alias: {
157+
'@': '/.vitepress'
158+
}
159+
}
160+
},
161+
162+
// 缓存重写
163+
transformPageData: (pageData) => {
164+
// 添加自定义页面数据
165+
pageData.frontmatter.head ??= []
166+
pageData.frontmatter.head.push([
167+
'meta',
168+
{ property: 'og:url', content: `https://lessup.github.io/hpc-ai-optimization-lab${pageData.relativePath}` }
169+
])
170+
}
171+
})

docs/.vitepress/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export { default } from './index.mts'
2+
export * from './index.mts'

docs/.vitepress/configs/index.mts

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
import type { HeadConfig, DefaultTheme } from 'vitepress'
2+
3+
// Head 配置
4+
export function head(): HeadConfig[] {
5+
return [
6+
// 字符编码和视口
7+
['meta', { charset: 'utf-8' }],
8+
['meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0' }],
9+
10+
// SEO
11+
['meta', { name: 'description', content: 'A comprehensive CUDA kernel optimization laboratory for AI workloads' }],
12+
['meta', { name: 'keywords', content: 'CUDA, GPU, optimization, HPC, AI, machine learning, Tensor Core, FlashAttention' }],
13+
['meta', { name: 'author', content: 'HPC-AI-Optimization-Lab Contributors' }],
14+
['meta', { name: 'theme-color', content: '#0891b2' }],
15+
16+
// Open Graph
17+
['meta', { property: 'og:type', content: 'website' }],
18+
['meta', { property: 'og:site_name', content: 'HPC-AI-Optimization-Lab' }],
19+
['meta', { property: 'og:title', content: 'HPC-AI-Optimization-Lab Documentation' }],
20+
['meta', { property: 'og:description', content: 'A comprehensive CUDA kernel optimization laboratory for AI workloads' }],
21+
['meta', { property: 'og:url', content: 'https://lessup.github.io/hpc-ai-optimization-lab/' }],
22+
['meta', { property: 'og:image', content: 'https://lessup.github.io/hpc-ai-optimization-lab/og-image.png' }],
23+
24+
// Twitter Card
25+
['meta', { name: 'twitter:card', content: 'summary_large_image' }],
26+
['meta', { name: 'twitter:title', content: 'HPC-AI-Optimization-Lab' }],
27+
['meta', { name: 'twitter:description', content: 'CUDA kernel optimization laboratory for AI workloads' }],
28+
29+
// 预连接到 CDN
30+
['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
31+
['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }],
32+
33+
// Favicon
34+
['link', { rel: 'icon', type: 'image/svg+xml', href: '/logo.svg' }],
35+
['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }],
36+
37+
// Canonical
38+
['link', { rel: 'canonical', href: 'https://lessup.github.io/hpc-ai-optimization-lab/' }],
39+
40+
// Performance hints
41+
['meta', { name: 'render-color', content: '#081120' }],
42+
['meta', { 'http-equiv': 'x-ua-compatible', content: 'ie=edge' }]
43+
]
44+
}
45+
46+
// 导航配置
47+
export function nav(): DefaultTheme.NavItem[] {
48+
return [
49+
{ text: 'Home', link: '/en/' },
50+
{
51+
text: 'Guide',
52+
items: [
53+
{ text: 'Getting Started', link: '/en/guide/' },
54+
{ text: 'Memory Optimization', link: '/en/guide/memory' },
55+
{ text: 'GEMM Optimization', link: '/en/guide/gemm' },
56+
{ text: 'FlashAttention', link: '/en/guide/flash-attention' }
57+
]
58+
},
59+
{
60+
text: 'API',
61+
items: [
62+
{ text: 'C++ / CUDA', link: '/cpp-api/index.html', target: '_blank' },
63+
{ text: 'Python', link: '/python-api/index.html', target: '_blank' }
64+
]
65+
},
66+
{ text: 'v0.3.0', link: '/en/changelog' }
67+
]
68+
}
69+
70+
// 侧边栏配置
71+
export function sidebar(): DefaultTheme.Sidebar {
72+
return {
73+
'/en/': [
74+
{
75+
text: 'Introduction',
76+
collapsed: false,
77+
items: [
78+
{ text: 'What is HPC-AI-Lab?', link: '/en/' },
79+
{ text: 'Quick Start', link: '/en/guide/quick-start' },
80+
{ text: 'Installation', link: '/en/guide/installation' }
81+
]
82+
},
83+
{
84+
text: 'Core Guides',
85+
collapsed: false,
86+
items: [
87+
{ text: 'Memory Optimization', link: '/en/guide/memory' },
88+
{ text: 'Reduction Optimization', link: '/en/guide/reduction' },
89+
{ text: 'GEMM Optimization', link: '/en/guide/gemm' },
90+
{ text: 'FlashAttention', link: '/en/guide/flash-attention' },
91+
{ text: 'CUDA 13 Features', link: '/en/guide/cuda13' }
92+
]
93+
}
94+
],
95+
'/zh-CN/': [
96+
{
97+
text: '介绍',
98+
collapsed: false,
99+
items: [
100+
{ text: '什么是 HPC-AI-Lab?', link: '/zh-CN/' },
101+
{ text: '快速开始', link: '/zh-CN/guide/quick-start' },
102+
{ text: '安装', link: '/zh-CN/guide/installation' }
103+
]
104+
},
105+
{
106+
text: '核心教程',
107+
collapsed: false,
108+
items: [
109+
{ text: '访存优化', link: '/zh-CN/guide/memory' },
110+
{ text: '归约优化', link: '/zh-CN/guide/reduction' },
111+
{ text: 'GEMM 优化', link: '/zh-CN/guide/gemm' },
112+
{ text: 'FlashAttention', link: '/zh-CN/guide/flash-attention' },
113+
{ text: 'CUDA 13 特性', link: '/zh-CN/guide/cuda13' }
114+
]
115+
}
116+
]
117+
}
118+
}
119+
120+
// 搜索配置
121+
export function search(): DefaultTheme.LocalSearchOptions {
122+
return {
123+
provider: 'local',
124+
options: {
125+
locales: {
126+
'zh-CN': {
127+
translations: {
128+
button: {
129+
buttonText: '搜索文档',
130+
buttonAriaLabel: '搜索文档'
131+
},
132+
modal: {
133+
noResultsText: '无法找到相关结果',
134+
resetButtonTitle: '清除查询条件',
135+
footer: {
136+
selectText: '选择',
137+
navigateText: '切换',
138+
closeText: '关闭'
139+
}
140+
}
141+
}
142+
}
143+
},
144+
miniSearch: {
145+
searchOptions: {
146+
boost: { title: 4, text: 2, titles: 1 }
147+
}
148+
}
149+
}
150+
}
151+
}

0 commit comments

Comments
 (0)