📝 优化文档显示

This commit is contained in:
远野千束 2024-08-30 17:56:01 +08:00
parent fbfb2b433b
commit d4fdd90ce2
14 changed files with 78 additions and 26 deletions

View File

@ -40,10 +40,10 @@ jobs:
- name: Setup API markdown
run: |-
python -m pip install litedoc
python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var -cs
python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var -cs
python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var -cs
python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var -cs
- name: 安装 pnpm
uses: pnpm/action-setup@v2

6
.gitignore vendored
View File

@ -18,4 +18,8 @@ litedoc/
docs/zh/api/
docs/zht/api/
docs/en/api/
docs/ja/api/
docs/ja/api/
# litedoc
mkdoc.bat
mkdoc_exp.bat

View File

@ -14,7 +14,42 @@ const commonSidebarOptions = {
useFolderTitleFromIndexFile: true,
useFolderLinkFromIndexFile: true,
includeFolderIndexFile: true,
rootGroupText: 'MBCP',
}
/**
* Generate sidebar config
* multiple languages and sections
* @returns {any[]}
*/
function generateSidebarConfig(): any[] {
let sections = ["api", "refer", "guide"]
let languages = ['zh', 'en', 'ja', 'zht']
let ret = []
for (let language of languages) {
for (let section of sections) {
if (language === defaultLocale) {
ret.push({
basePath: `/${section}/`,
scanStartPath: `${language}/${section}`,
resolvePath: `/${section}/`,
...commonSidebarOptions
})
} else {
ret.push({
basePath: `/${language}/${section}/`,
scanStartPath: `${language}/${section}`,
resolvePath: `/${language}/${section}/`,
...commonSidebarOptions
})
}
}
}
return ret
}
console.log(generateSidebarConfig())
export const common = defineConfig({
title: "MBCP docs",
description: "MBCP library docs",
@ -27,23 +62,7 @@ export const common = defineConfig({
themeConfig: {
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
}
}
})
...generateSidebarConfig()
]
),
socialLinks: [

View File

@ -6,6 +6,7 @@ export const en = defineConfig({
themeConfig: {
nav: [
{text: 'Get Start', link: '/en/guide/'},
{text: 'Reference', link: '/en/refer'},
{text: 'API Document', link: '/en/api/'},
{text: 'Demo', link: '/en/demo/'},
],

View File

@ -6,6 +6,7 @@ export const ja = defineConfig({
themeConfig: {
nav: [
{text: 'スタート', link: '/ja/guide/'},
{text: 'リファレンス', link: '/ja/refer'},
{text: 'APIドキュメント', link: '/ja/api/'},
{text: 'インスタンス', link: '/ja/demo/'},
],

View File

@ -6,6 +6,7 @@ export const zh = defineConfig({
themeConfig: {
nav: [
{text: '快速开始', link: '/guide/'},
{text: '参考', link: '/refer'},
{text: 'API文档', link: '/api/'},
{text: '实例', link: '/demo/'},
],

View File

@ -7,6 +7,7 @@ export const zht = defineConfig({
themeConfig: {
nav: [
{text: '指引', link: '/zht/guide/'},
{text: '參考', link: '/zht/refer'},
{text: 'API文檔', link: '/zht/api/'},
{text: '示範', link: '/zht/demo/'},
],

3
docs/en/refer/index.md Normal file
View File

@ -0,0 +1,3 @@
# Reference
help us to improve the documentation
```

4
docs/ja/refer/index.md Normal file
View File

@ -0,0 +1,4 @@
# Reference
Help us to improve the documentation
```

View File

@ -0,0 +1,3 @@
---
title: 柯里化
---

View File

@ -0,0 +1,3 @@
---
title: 函数
---

8
docs/zh/refer/index.md Normal file
View File

@ -0,0 +1,8 @@
---
title: 参考
---
# Reference
Help us to improve the documentation
```

4
docs/zht/refer/index.md Normal file
View File

@ -0,0 +1,4 @@
# Reference
Help us to improve the documentation
```

View File

@ -1,5 +1,5 @@
chcp 65001
python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var
python -m litedoc mbcp -o docs/zh/api -l zh-Hans -f editLink=false -cd class -fd def -md def -vd var -cs
python -m litedoc mbcp -o docs/en/api -l en -f editLink=false -cd class -fd def -md def -vd var -cs
python -m litedoc mbcp -o docs/ja/api -l ja -f editLink=false -cd class -fd def -md def -vd var -cs
python -m litedoc mbcp -o docs/zht/api -l zh-Hant -f editLink=false -cd class -fd def -md def -vd var -cs