📝 优化文档显示

This commit is contained in:
2024-08-31 06:06:32 +08:00
parent e0b4610161
commit 2c0be2c6f0
15 changed files with 155 additions and 47 deletions

View File

@@ -51,8 +51,11 @@ function generateSidebarConfig(): any[] {
console.log(generateSidebarConfig())
export const common = defineConfig({
title: "MBCP docs",
description: "MBCP library docs",
head: [
[
'link', {rel: 'icon', type: 'image/svg+xml', href: '/mbcp-logo.svg'}
]
],
markdown: {
math: true
},
@@ -60,6 +63,7 @@ export const common = defineConfig({
[`${defaultLocale}/:rest*`]: ":rest*",
},
themeConfig: {
logo: '/mbcp-logo.svg',
sidebar: generateSidebar(
[
...generateSidebarConfig()
@@ -68,9 +72,6 @@ export const common = defineConfig({
socialLinks: [
{icon: 'github', link: 'https://github.com/snowykami/mbcp'}
],
editLink: {
pattern: 'https://github.com/snowykami/mbcp/tree/main/docs/:path'
},
outline: [2, 6]
},
sitemap: {

View File

@@ -1,15 +1,24 @@
import {defineConfig} from 'vitepress'
import {ThemeConfig} from "./utils";
export const en = defineConfig({
lang: "en-US",
description: "A library made for Minecraft particle generation",
title: "MBCP docs",
description: "MBCP library docs",
themeConfig: {
nav: [
{text: 'Get Start', link: '/en/guide/'},
{text: 'Reference', link: '/en/refer'},
{text: 'API Document', link: '/en/api/'},
{text: 'API Reference', link: '/en/api/'},
{text: 'Demo', link: '/en/demo/'},
],
docFooter: {
prev: 'Prev Page',
next: 'Next Page'
},
editLink: ThemeConfig.getEditLink(
'Edit this page on GitHub',
),
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,15 +1,24 @@
import {defineConfig} from 'vitepress'
import {ThemeConfig} from "./utils";
export const ja = defineConfig({
lang: "ja-JP",
description: "Minecraftのパーティクル生成用のライブラリ",
title: "MBCP ドキュメント",
description: "MBCP ライブラリ ドキュメント",
themeConfig: {
nav: [
{text: 'スタート', link: '/ja/guide/'},
{text: 'リファレンス', link: '/ja/refer'},
{text: 'APIドキュメント', link: '/ja/api/'},
{text: 'APIリファレンス', link: '/ja/api/'},
{text: 'インスタンス', link: '/ja/demo/'},
],
docFooter: {
prev: '前のページ',
next: '次のページ'
},
editLink: ThemeConfig.getEditLink(
'このページをGitHubで編集する',
),
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

@@ -0,0 +1,23 @@
/**
* GetEditLink Options
* @param text Edit link text
*/
export const ThemeConfig = {
getEditLink: (editPageText: string): { pattern: (params: { filePath: string; }) => string; text: string; } => {
return {
pattern: ({filePath}: { filePath: string; }): string => {
const regex = /^[^\/]+\/api/;
if (regex.test(filePath)) {
// remove {lang}/api prefix
filePath = filePath.replace(regex, '')
.replace('index.md', '__init__.py')
.replace('.md', '.py');
return `https://github.com/snowykami/mbcp/tree/main/mbcp/${filePath}`;
} else {
return `https://github.com/snowykami/mbcp/tree/main/docs/${filePath}`;
}
},
text: editPageText
};
}
}

View File

@@ -1,15 +1,24 @@
import {defineConfig} from 'vitepress'
import {ThemeConfig} from "./utils";
export const zh = defineConfig({
lang: "zh-Hans",
description: "一个用于Minecraft粒子计算和生成的库",
title: "MBCP 文档",
description: "MBCP 粒子计算和生成库文档",
themeConfig: {
nav: [
{text: '快速开始', link: '/guide/'},
{text: '参考', link: '/refer'},
{text: 'API文档', link: '/api/'},
{text: 'API引用', link: '/api/'},
{text: '实例', link: '/demo/'},
],
docFooter: {
prev: '上一页',
next: '下一页'
},
editLink: ThemeConfig.getEditLink(
'在 GitHub 上编辑此页',
),
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

@@ -1,16 +1,24 @@
import {defineConfig} from 'vitepress'
import {ThemeConfig} from "./utils";
export const zht = defineConfig({
lang: "zh-Hant",
description: "一個用於Minecraft粒子計算和生成的軟體庫",
title: "MBCP 文檔",
description: "MBCP 粒子計算和生成庫文檔",
themeConfig: {
nav: [
{text: '指引', link: '/zht/guide/'},
{text: '參考', link: '/zht/refer'},
{text: 'API文檔', link: '/zht/api/'},
{text: 'API引用', link: '/zht/api/'},
{text: '示範', link: '/zht/demo/'},
],
docFooter: {
prev: '上一頁',
next: '下一頁'
},
editLink: ThemeConfig.getEditLink(
'於 GitHub 上編輯這頁',
),
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'