Skip to content

Commit

Permalink
docs: bugfix + rewrites
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyi-Lin committed Nov 27, 2024
1 parent 4528e04 commit 6663be8
Show file tree
Hide file tree
Showing 6 changed files with 174 additions and 16 deletions.
11 changes: 5 additions & 6 deletions .vitepress/config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import { zh } from './zh'
import { en } from './en'

export default defineConfig({
// 标签页logo
head: [
['link', { rel: 'icon', type:"image/svg+xml", href: '/icon.svg' }],
['link', { rel: 'icon', type:"image/png", href: '/icon.png' }],
],
rewrites: {
'zh/:rest*': ':rest*'
},

locales: {
zh: { label: '简体中文', ...zh },
root: { label: '简体中文', ...zh },
en: { label: 'English', ...en },
}
})
4 changes: 4 additions & 0 deletions .vitepress/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ export const en = defineConfig({
description: "SwanLab Official Documentation, providing the most comprehensive user guide and API documentation",
lang: 'en-US',

head: [
['link', { rel: 'icon', type:"image/svg+xml", href: '/icon.svg' }],
['link', { rel: 'icon', type:"image/png", href: '/icon.png' }],
],

themeConfig: {
// https://vitepress.dev/reference/default-theme-config
Expand Down
77 changes: 77 additions & 0 deletions .vitepress/vue-official.mts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import { defineConfig } from 'vitepress'
import { search as zhSearch } from './zh'
import { search as ptSearch } from './pt'
import { search as ruSearch } from './ru'
import { search as esSearch } from './es'
import { search as koSearch } from './ko'

export const shared = defineConfig({
title: 'VitePress',

rewrites: {
'en/:rest*': ':rest*'
},

lastUpdated: true,
cleanUrls: true,
metaChunk: true,

markdown: {
math: true,
codeTransformers: [
// We use `[!!code` in demo to prevent transformation, here we revert it back.
{
postprocess(code) {
return code.replace(/\[\!\!code/g, '[!code')
}
}
]
},

sitemap: {
hostname: 'https://vitepress.dev',
transformItems(items) {
return items.filter((item) => !item.url.includes('migration'))
}
},

/* prettier-ignore */
head: [
['link', { rel: 'icon', type: 'image/svg+xml', href: '/vitepress-logo-mini.svg' }],
['link', { rel: 'icon', type: 'image/png', href: '/vitepress-logo-mini.png' }],
['meta', { name: 'theme-color', content: '#5f67ee' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:locale', content: 'en' }],
['meta', { property: 'og:title', content: 'VitePress | Vite & Vue Powered Static Site Generator' }],
['meta', { property: 'og:site_name', content: 'VitePress' }],
['meta', { property: 'og:image', content: 'https://vitepress.dev/vitepress-og.jpg' }],
['meta', { property: 'og:url', content: 'https://vitepress.dev/' }],
['script', { src: 'https://cdn.usefathom.com/script.js', 'data-site': 'AZBRSFGG', 'data-spa': 'auto', defer: '' }]
],

themeConfig: {
logo: { src: '/vitepress-logo-mini.svg', width: 24, height: 24 },

socialLinks: [
{ icon: 'github', link: 'https://github.com/vuejs/vitepress' }
],

search: {
provider: 'algolia',
options: {
appId: '8J64VVRP8K',
apiKey: '52f578a92b88ad6abde815aae2b0ad7c',
indexName: 'vitepress',
locales: {
...zhSearch,
...ptSearch,
...ruSearch,
...esSearch,
...koSearch
}
}
},

carbonAds: { code: 'CEBDT27Y', placement: 'vuejsorg' }
}
})
27 changes: 17 additions & 10 deletions .vitepress/zh.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
import { defineConfig, type DefaultTheme} from 'vitepress'

var base_path_guide_cloud = '/zh/guide_cloud'
var base_path_examples = '/zh/examples'
var base_path_api = '/zh/api'
var base_path_guide_cloud = '/guide_cloud'
var base_path_examples = '/examples'
var base_path_api = '/api'

// https://vitepress.dev/reference/site-config
export const zh = defineConfig({
title: "SwanLab官方文档",
description: "SwanLab官方文档, 提供最全面的使用指南和API文档",
lang: 'zh-CN',

head: [
['link', { rel: 'icon', type:"image/svg+xml", href: '/icon.svg' }],
['link', { rel: 'icon', type:"image/png", href: '/icon.png' }],
],

// markdown: {
// lineNumbers: true
// },
Expand All @@ -24,24 +29,24 @@ export const zh = defineConfig({
{
text: '用户指南',
link: base_path_guide_cloud + '/general/what-is-swanlab',
activeMatch: '/zh/guide_cloud/',
activeMatch: 'h/guide_cloud/',
},
{
text: '案例',
link: base_path_examples + '/mnist',
activeMatch: '/zh/examples/',
activeMatch: 'h/examples/',
},
{
text: 'API',
link: base_path_api + '/api-index',
activeMatch: '/zh/api/',
activeMatch: 'h/api/',
},
{ text: 'v0.3.27', items: [
{ text: '更新日志', link: base_path_guide_cloud + '/general/changelog' },
{ text: '参与贡献', link: 'https://github.com/SwanHubX/SwanLab/blob/main/CONTRIBUTING.md' },
{ text: '建议反馈', link: 'https://geektechstudio.feishu.cn/share/base/form/shrcn8koDFRcH2mMcBYMh9tiKfI'}
] },
{ text: '在线交流', link: '/zh/guide_cloud/community/online-support'},
{ text: '在线交流', link: 'h/guide_cloud/community/online-support'},
{ text: '官网', link: 'https://swanlab.cn' },
],

Expand All @@ -54,6 +59,8 @@ export const zh = defineConfig({
},
},

langMenuLabel: '多语言',

// 编辑此页配置
editLink: {
pattern: 'https://github.com/swanhubx/swanlab-docs/edit/main/:path',
Expand All @@ -68,9 +75,9 @@ export const zh = defineConfig({

// 侧边栏配置
sidebar: {
'/zh/guide_cloud/':{base: '/zh/guide_cloud/', items: sidebarGuideCloud(),},
'/zh/examples/':{base: '/zh/examples/', items: sidebarExamples(),},
'/zh/api/':{base: '/zh/api/', items: sidebarAPI(),},
'/guide_cloud/':{base: '/guide_cloud/', items: sidebarGuideCloud(),},
'/examples/':{base: '/examples/', items: sidebarExamples(),},
'/api/':{base: '/api/', items: sidebarAPI(),},
},

// 页脚配置
Expand Down
71 changes: 71 additions & 0 deletions en/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
---
layout: home

title: SwanLab Docs
titleTemplate: Advanced AI Team Collaboration and Model Innovation Engine

hero:
name: SwanLab
text: Track and Visualize Your AI Experiments
tagline: One-stop Experiment Tracking and Training Visualization Tool
actions:
- theme: brand
text: Documentation
link: /en/guide_cloud/general/what-is-swanlab.md
- theme: brand
text: Website
link: https://dev101.swanlab.cn
# - theme: alt
# text: 快速开始
# link: /en/guide_cloud/general/quick-start.md
- theme: alt
text: Docs GitHub
link: https://github.com/SwanHubX/SwanLab-Docs
image:
src: /page.png
alt: VitePress

features:
- icon: 🚢
title: Quick Start
details: Install SwanLab and start tracking your AI experiments in minutes.
link: /en/guide_cloud/general/quick-start.md

# - icon: 📚
# title: 案例
# details: SwanLab官方案例合集,更好地理解SwanLab在人工智能pipeline中扮演的角色和作用。
# link: /en/examples/mnist

# - icon: 🤗
# title: 集成
# details: 与HuggingFace Transformers、PyTorch Lightning、Hydra等主流框架的集成文档。
# link: /en/guide_cloud/integration/integration-pytorch-lightning.md

# - icon: ⚡️
# title: API文档
# details: Python库和CLI的完整API文档
# link: en/api/api-index

---

<style>
:root {
--vp-home-hero-name-color: transparent;
--vp-home-hero-name-background: -webkit-linear-gradient(120deg, #637de8 50%, #63ca8c);

--vp-home-hero-image-background-image: linear-gradient(-45deg, #8d9956 50%, #47caff 50%);
--vp-home-hero-image-filter: blur(44px);
}

@media (min-width: 640px) {
:root {
--vp-home-hero-image-filter: blur(56px);
}
}

@media (min-width: 960px) {
:root {
--vp-home-hero-image-filter: blur(68px);
}
}
</style>
File renamed without changes.

0 comments on commit 6663be8

Please sign in to comment.