2024-08-28 11:56:19 +08:00
|
|
|
import {defineConfig} from 'vitepress'
|
2024-08-29 19:00:01 +08:00
|
|
|
import {generateSidebar} from 'vitepress-sidebar';
|
|
|
|
import {zh} from "./zh";
|
|
|
|
import {en} from "./en";
|
|
|
|
import {ja} from "./ja";
|
|
|
|
import {zht} from "./zht";
|
2024-08-28 11:38:46 +08:00
|
|
|
|
2024-08-29 19:00:01 +08:00
|
|
|
let defaultLocale = 'zh';
|
|
|
|
const commonSidebarOptions = {
|
|
|
|
collapsed: true,
|
|
|
|
convertSameNameSubFileToGroupIndexPage: true,
|
|
|
|
useFolderTitleFromIndexFile: true,
|
|
|
|
useFolderLinkFromIndexFile: true,
|
|
|
|
useTitleFromFrontmatter: true,
|
|
|
|
useTitleFromFileHeading: true,
|
|
|
|
includeFolderIndexFile: true,
|
|
|
|
}
|
2024-08-28 11:38:46 +08:00
|
|
|
export const common = defineConfig({
|
|
|
|
title: "MBCP docs",
|
|
|
|
description: "MBCP library docs",
|
2024-08-29 19:00:01 +08:00
|
|
|
markdown: {
|
|
|
|
math: true
|
|
|
|
},
|
2024-08-28 12:02:30 +08:00
|
|
|
vite: {
|
2024-08-29 19:00:01 +08:00
|
|
|
plugins: [],
|
|
|
|
},
|
|
|
|
rewrites: {
|
|
|
|
[`${defaultLocale}/:rest*`]: ":rest*",
|
2024-08-28 12:02:30 +08:00
|
|
|
},
|
2024-08-28 11:38:46 +08:00
|
|
|
themeConfig: {
|
2024-08-29 19:00:01 +08:00
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})
|
|
|
|
]
|
|
|
|
),
|
2024-08-28 11:38:46 +08:00
|
|
|
socialLinks: [
|
|
|
|
{icon: 'github', link: 'https://github.com/snowykami/mbcp'}
|
2024-08-29 19:00:01 +08:00
|
|
|
],
|
|
|
|
},
|
|
|
|
locales: {
|
|
|
|
root: {label: "简体中文", ...zh},
|
|
|
|
en: {label: "English", ...en},
|
|
|
|
ja: {label: "日本語", ...ja},
|
|
|
|
zht: {label: "繁體中文", ...zht},
|
2024-08-28 11:38:46 +08:00
|
|
|
},
|
|
|
|
})
|