📝 优化文档显示

This commit is contained in:
2024-08-29 19:00:01 +08:00
committed by snowykami
parent d027d4b862
commit c08a0c7fda
38 changed files with 490 additions and 273 deletions

View File

@@ -1,28 +1,62 @@
import {defineConfig} from 'vitepress'
import {generateSidebar} from 'vitepress-sidebar';
import {zh} from "./zh";
import {en} from "./en";
import {ja} from "./ja";
import {zht} from "./zht";
import AutoSidebarPlugin from 'vitepress-auto-sidebar-plugin'
let defaultLocale = 'zh';
const commonSidebarOptions = {
collapsed: true,
convertSameNameSubFileToGroupIndexPage: true,
useFolderTitleFromIndexFile: true,
useFolderLinkFromIndexFile: true,
useTitleFromFrontmatter: true,
useTitleFromFileHeading: true,
includeFolderIndexFile: true,
}
export const common = defineConfig({
title: "MBCP docs",
description: "MBCP library docs",
markdown: {
math: true
},
vite: {
plugins: [
AutoSidebarPlugin({
// 如果不指定 `srcDir`,则默认使用 `vitepress` 的 `srcDir`
ignoreList: [
'README.md'
],
title: {
mode: text => text.toLowerCase()
}
}),
],
plugins: [],
},
rewrites: {
[`${defaultLocale}/:rest*`]: ":rest*",
},
themeConfig: {
// https://vitepress.dev/reference/default-theme-config
sidebar: generateSidebar(
[
...[defaultLocale, 'en', 'ja', 'zht'].map((locale) => {
if (locale === defaultLocale) {
return {
basePath: '/api/',
scanStartPath: `${locale}/api`,
resolvePath: '/api/',
...commonSidebarOptions
}
} else {
return {
basePath: `/${locale}/api/`,
scanStartPath: `${locale}/api`,
resolvePath: `/${locale}/api/`,
...commonSidebarOptions
}
}
})
]
),
socialLinks: [
{icon: 'github', link: 'https://github.com/snowykami/mbcp'}
]
],
},
locales: {
root: {label: "简体中文", ...zh},
en: {label: "English", ...en},
ja: {label: "日本語", ...ja},
zht: {label: "繁體中文", ...zht},
},
srcDir: '.'
})

View File

@@ -1,14 +1,17 @@
import {defineConfig} from 'vitepress'
export const en = defineConfig({
lang: "en-US",
description: "A library made for Minecraft particle generation",
themeConfig: {
nav: [
{text: 'Get Start', link: '/guide'},
{text: 'API Document', link: '/api/'},
{text: 'Demo', link: '/demo/'},
{text: 'Get Start', link: '/en/guide/'},
{text: 'API Document', link: '/en/api/'},
{text: 'Demo', link: '/en/demo/'},
],
footer: {
message: 'Documentation built with <a href="https://vitepress.dev/">VitePress</a> | API references generated by <a href="https://github.com/LiteyukiStudio/litedoc">litedoc</a>',
copyright: 'Copyright (C) 2020-2024 SnowyKami. All Rights Reserved'
}
},
})

View File

@@ -1,19 +1,6 @@
import {defineConfig} from "vitepress";
import {common} from './common'
import {en} from './en'
import {zh} from './zh'
import {zht} from './zht'
import {ja} from './ja'
export default defineConfig({
...common,
locales:{
root: { label: "简体中文", ...zh },
en: { label: "English", ...en },
ja: { label: "日本語", ...ja },
zht: { label: "繁體中文", ...zht },
}
})

View File

@@ -1,14 +1,17 @@
import {defineConfig} from 'vitepress'
export const ja = defineConfig({
lang: "ja-JP",
description: "Minecraftのパーティクル生成用のライブラリ",
themeConfig: {
nav: [
{text: 'スタート', link: '/guide'},
{text: 'APIドキュメント', link: '/api/'},
{text: 'インスタンス', link: '/demo/'},
{text: 'スタート', link: '/ja/guide/'},
{text: 'APIドキュメント', link: '/ja/api/'},
{text: 'インスタンス', link: '/ja/demo/'},
],
footer: {
message: '<a href="https://vitepress.dev/">VitePress</a> で構築されたドキュメント | <a href="https://github.com/LiteyukiStudio/litedoc">litedoc</a> によって生成されたAPIリファレンス',
copyright: 'Copyright (C) 2020-2024 SnowyKami. All Rights Reserved'
}
},
})

View File

@@ -1,7 +1,6 @@
import {defineConfig} from 'vitepress'
export const zh = defineConfig({
lang: "zh-Hans",
description: "一个用于Minecraft粒子计算和生成的库",
themeConfig: {
@@ -10,5 +9,9 @@ export const zh = defineConfig({
{text: 'API文档', link: '/api/'},
{text: '实例', link: '/demo/'},
],
footer: {
message: '文档由 <a href="https://vitepress.dev/">VitePress</a> 构建 | API引用由 <a href="https://github.com/LiteyukiStudio/litedoc">litedoc</a> 生成',
copyright: 'Copyright (C) 2020-2024 SnowyKami. All Rights Reserved'
}
},
})

View File

@@ -6,9 +6,13 @@ export const zht = defineConfig({
description: "一個用於Minecraft粒子計算和生成的軟體庫",
themeConfig: {
nav: [
{text: '指引', link: '/guide/'},
{text: 'API文檔', link: '/api/'},
{text: '示範', link: '/demo/'},
{text: '指引', link: '/zht/guide/'},
{text: 'API文檔', link: '/zht/api/'},
{text: '示範', link: '/zht/demo/'},
],
footer: {
message: '文檔由 <a href="https://vitepress.dev/">VitePress</a> 構建 | API引用由 <a href="https://github.com/LiteyukiStudio/litedoc">litedoc</a> 生成',
copyright: 'Copyright (C) 2020-2024 SnowyKami. All Rights Reserved'
}
},
})