mirror of
https://github.com/LiteyukiStudio/nonebot-plugin-marshoai.git
synced 2025-03-04 04:33:40 +08:00
📝 使用Liteyukiflare对GitHub Page文档进行亚太地区加速
This commit is contained in:
parent
00605ad401
commit
cbafaaf151
@ -1,81 +1,87 @@
|
|||||||
import { VitePressSidebarOptions } from "vitepress-sidebar/types"
|
import { VitePressSidebarOptions } from "vitepress-sidebar/types";
|
||||||
|
|
||||||
export const gitea = {
|
export const gitea = {
|
||||||
svg: '<svg t="1725391346807" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5067" width="256" height="256"><path d="M1004.692673 466.396616l-447.094409-447.073929c-25.743103-25.763582-67.501405-25.763582-93.264987 0l-103.873521 103.873521 78.171378 78.171378c12.533635-6.00058 26.562294-9.359266 41.389666-9.359266 53.02219 0 96.00928 42.98709 96.00928 96.00928 0 14.827372-3.358686 28.856031-9.359266 41.389666l127.97824 127.97824c12.533635-6.00058 26.562294-9.359266 41.389666-9.359266 53.02219 0 96.00928 42.98709 96.00928 96.00928s-42.98709 96.00928-96.00928 96.00928-96.00928-42.98709-96.00928-96.00928c0-14.827372 3.358686-28.856031 9.359266-41.389666l-127.97824-127.97824c-3.051489 1.454065-6.184898 2.744293-9.379746 3.870681l0 266.97461c37.273227 13.188988 63.99936 48.721433 63.99936 90.520695 0 53.02219-42.98709 96.00928-96.00928 96.00928s-96.00928-42.98709-96.00928-96.00928c0-41.799262 26.726133-77.331707 63.99936-90.520695l0-266.97461c-37.273227-13.188988-63.99936-48.721433-63.99936-90.520695 0-14.827372 3.358686-28.856031 9.359266-41.389666l-78.171378-78.171378-295.892081 295.871601c-25.743103 25.784062-25.743103 67.542365 0 93.285467l447.114889 447.073929c25.743103 25.743103 67.480925 25.743103 93.264987 0l445.00547-445.00547c25.763582-25.763582 25.763582-67.542365 0-93.285467z" fill="#a2d8f4" p-id="5068"></path></svg>'
|
svg: '<svg t="1725391346807" class="icon" viewBox="0 0 1025 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5067" width="256" height="256"><path d="M1004.692673 466.396616l-447.094409-447.073929c-25.743103-25.763582-67.501405-25.763582-93.264987 0l-103.873521 103.873521 78.171378 78.171378c12.533635-6.00058 26.562294-9.359266 41.389666-9.359266 53.02219 0 96.00928 42.98709 96.00928 96.00928 0 14.827372-3.358686 28.856031-9.359266 41.389666l127.97824 127.97824c12.533635-6.00058 26.562294-9.359266 41.389666-9.359266 53.02219 0 96.00928 42.98709 96.00928 96.00928s-42.98709 96.00928-96.00928 96.00928-96.00928-42.98709-96.00928-96.00928c0-14.827372 3.358686-28.856031 9.359266-41.389666l-127.97824-127.97824c-3.051489 1.454065-6.184898 2.744293-9.379746 3.870681l0 266.97461c37.273227 13.188988 63.99936 48.721433 63.99936 90.520695 0 53.02219-42.98709 96.00928-96.00928 96.00928s-96.00928-42.98709-96.00928-96.00928c0-41.799262 26.726133-77.331707 63.99936-90.520695l0-266.97461c-37.273227-13.188988-63.99936-48.721433-63.99936-90.520695 0-14.827372 3.358686-28.856031 9.359266-41.389666l-78.171378-78.171378-295.892081 295.871601c-25.743103 25.784062-25.743103 67.542365 0 93.285467l447.114889 447.073929c25.743103 25.743103 67.480925 25.743103 93.264987 0l445.00547-445.00547c25.763582-25.763582 25.763582-67.542365 0-93.285467z" fill="#a2d8f4" p-id="5068"></path></svg>',
|
||||||
}
|
};
|
||||||
|
|
||||||
export const defaultLang = 'zh'
|
export const defaultLang = "zh";
|
||||||
|
|
||||||
const commonSidebarOptions: VitePressSidebarOptions = {
|
const commonSidebarOptions: VitePressSidebarOptions = {
|
||||||
collapsed: true,
|
collapsed: true,
|
||||||
convertSameNameSubFileToGroupIndexPage: true,
|
convertSameNameSubFileToGroupIndexPage: true,
|
||||||
useTitleFromFrontmatter: true,
|
useTitleFromFrontmatter: true,
|
||||||
useFolderTitleFromIndexFile: false,
|
useFolderTitleFromIndexFile: false,
|
||||||
useFolderLinkFromIndexFile: true,
|
useFolderLinkFromIndexFile: true,
|
||||||
useTitleFromFileHeading: true,
|
useTitleFromFileHeading: true,
|
||||||
rootGroupText: 'MARSHOAI',
|
rootGroupText: "MARSHOAI",
|
||||||
includeFolderIndexFile: true,
|
includeFolderIndexFile: true,
|
||||||
sortMenusByFrontmatterOrder: true,
|
sortMenusByFrontmatterOrder: true,
|
||||||
}
|
};
|
||||||
|
|
||||||
export function generateSidebarConfig(): VitePressSidebarOptions[] {
|
export function generateSidebarConfig(): VitePressSidebarOptions[] {
|
||||||
let sections = ["dev", "start"]
|
let sections = ["dev", "start"];
|
||||||
let languages = ['zh', 'en']
|
let languages = ["zh", "en"];
|
||||||
let ret: VitePressSidebarOptions[] = []
|
let ret: VitePressSidebarOptions[] = [];
|
||||||
for (let language of languages) {
|
for (let language of languages) {
|
||||||
for (let section of sections) {
|
for (let section of sections) {
|
||||||
if (language === defaultLang) {
|
if (language === defaultLang) {
|
||||||
ret.push({
|
ret.push({
|
||||||
basePath: `/${section}/`,
|
basePath: `/${section}/`,
|
||||||
scanStartPath: `docs/${language}/${section}`,
|
scanStartPath: `docs/${language}/${section}`,
|
||||||
resolvePath: `/${section}/`,
|
resolvePath: `/${section}/`,
|
||||||
...commonSidebarOptions
|
...commonSidebarOptions,
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
ret.push({
|
ret.push({
|
||||||
basePath: `/${language}/${section}/`,
|
basePath: `/${language}/${section}/`,
|
||||||
scanStartPath: `docs/${language}/${section}`,
|
scanStartPath: `docs/${language}/${section}`,
|
||||||
resolvePath: `/${language}/${section}/`,
|
resolvePath: `/${language}/${section}/`,
|
||||||
...commonSidebarOptions
|
...commonSidebarOptions,
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return ret
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const ThemeConfig = {
|
export const ThemeConfig = {
|
||||||
getEditLink: (editPageText: string): { pattern: (params: { filePath: string; }) => string; text: string; } => {
|
getEditLink: (
|
||||||
return {
|
editPageText: string
|
||||||
pattern: ({filePath}: { filePath: string; }): string => {
|
): { pattern: (params: { filePath: string }) => string; text: string } => {
|
||||||
if (!filePath) {
|
return {
|
||||||
throw new Error("filePath is undefined");
|
pattern: ({ filePath }: { filePath: string }): string => {
|
||||||
}
|
if (!filePath) {
|
||||||
const regex = /^(dev\/api|[^\/]+\/dev\/api)/;
|
throw new Error("filePath is undefined");
|
||||||
if (regex.test(filePath)) {
|
}
|
||||||
filePath = filePath.replace(regex, '')
|
const regex = /^(dev\/api|[^\/]+\/dev\/api)/;
|
||||||
.replace('index.md', '__init__.py')
|
if (regex.test(filePath)) {
|
||||||
.replace('.md', '.py');
|
filePath = filePath
|
||||||
const fileName = filePath.split('/').pop();
|
.replace(regex, "")
|
||||||
const parentFolder = filePath.split('/').slice(-2, -1)[0];
|
.replace("index.md", "__init__.py")
|
||||||
if (fileName && parentFolder && fileName.split('.')[0] === parentFolder) {
|
.replace(".md", ".py");
|
||||||
filePath = filePath.split('/').slice(0, -1).join('/') + '/__init__.py';
|
const fileName = filePath.split("/").pop();
|
||||||
}
|
const parentFolder = filePath.split("/").slice(-2, -1)[0];
|
||||||
return `https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/${filePath}`;
|
if (
|
||||||
} else {
|
fileName &&
|
||||||
return `https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/docs/${filePath}`;
|
parentFolder &&
|
||||||
}
|
fileName.split(".")[0] === parentFolder
|
||||||
},
|
) {
|
||||||
text: editPageText
|
filePath =
|
||||||
};
|
filePath.split("/").slice(0, -1).join("/") + "/__init__.py";
|
||||||
},
|
}
|
||||||
|
return `https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/nonebot_plugin_marshoai/${filePath}`;
|
||||||
|
} else {
|
||||||
|
return `https://github.com/LiteyukiStudio/nonebot-plugin-marshoai/tree/main/docs/${filePath}`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
text: editPageText,
|
||||||
|
};
|
||||||
|
},
|
||||||
|
|
||||||
getOutLine: (label: string): { label: string; level: [number, number]; } => {
|
getOutLine: (label: string): { label: string; level: [number, number] } => {
|
||||||
return {
|
return {
|
||||||
label: label,
|
label: label,
|
||||||
level: [2, 6]
|
level: [2, 6],
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
};
|
||||||
copyright: 'Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved'
|
|
||||||
}
|
|
||||||
|
@ -23,7 +23,7 @@ export const en = defineConfig({
|
|||||||
lightModeSwitchTitle: 'Light',
|
lightModeSwitchTitle: 'Light',
|
||||||
darkModeSwitchTitle: 'Dark',
|
darkModeSwitchTitle: 'Dark',
|
||||||
footer: {
|
footer: {
|
||||||
message: "The document is being improved. Suggestions are welcome.",
|
message: "The document is being improved. Suggestions are welcome.<br>Webpage is accelerated by <a href='https://cdn.liteyuki.icu' target='_blank'>Liteyukiflare CDN</a>.",
|
||||||
copyright: '© 2024 <a href="https://liteyuki.icu" target="_blank">Liteyuki Studio</a>',
|
copyright: '© 2024 <a href="https://liteyuki.icu" target="_blank">Liteyuki Studio</a>',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,7 +23,7 @@ export const ja = defineConfig({
|
|||||||
lightModeSwitchTitle: 'ライト',
|
lightModeSwitchTitle: 'ライト',
|
||||||
darkModeSwitchTitle: 'ダーク',
|
darkModeSwitchTitle: 'ダーク',
|
||||||
footer: {
|
footer: {
|
||||||
message: "ドキュメントは改善中です。ご意見をお待ちしております。",
|
message: "ドキュメントは改善中です。ご意見をお待ちしております。<br>ウェブページは <a href='https://cdn.liteyuki.icu' target='_blank'>Liteyukiflare CDN</a> によって加速されています。",
|
||||||
copyright: '© 2024 <a href="https://liteyuki.icu" target="_blank">Liteyuki Studio</a>',
|
copyright: '© 2024 <a href="https://liteyuki.icu" target="_blank">Liteyuki Studio</a>',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -23,7 +23,7 @@ export const zh = defineConfig({
|
|||||||
lightModeSwitchTitle: '轻色模式',
|
lightModeSwitchTitle: '轻色模式',
|
||||||
darkModeSwitchTitle: '深色模式',
|
darkModeSwitchTitle: '深色模式',
|
||||||
footer: {
|
footer: {
|
||||||
message: "文档完善中,欢迎提出建议或帮助我们完善。",
|
message: "文档完善中,欢迎提出建议或帮助我们完善。<br>网页由 <a href='https://cdn.liteyuki.icu' target='_blank'>Liteyukiflare CDN</a> 提供加速服务。",
|
||||||
copyright: '© 2024 <a href="https://liteyuki.icu" target="_blank">Liteyuki Studio</a>',
|
copyright: '© 2024 <a href="https://liteyuki.icu" target="_blank">Liteyuki Studio</a>',
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user