diff --git a/docs/.vitepress/config/common.ts b/docs/.vitepress/config/common.ts index cfb1cd6b..765cfbfd 100755 --- a/docs/.vitepress/config/common.ts +++ b/docs/.vitepress/config/common.ts @@ -42,4 +42,40 @@ export function generateSidebarConfig(): VitePressSidebarOptions[] { } } return ret +} + +export const ThemeConfig = { + getEditLink: (editPageText: string): { pattern: (params: { filePath: string; }) => string; text: string; } => { + return { + pattern: ({filePath}: { filePath: string; }): string => { + if (!filePath) { + throw new Error("filePath is undefined"); + } + const regex = /^(dev\/api|[^\/]+\/dev\/api)/; + if (regex.test(filePath)) { + filePath = filePath.replace(regex, '') + .replace('index.md', '__init__.py') + .replace('.md', '.py'); + const fileName = filePath.split('/').pop(); + const parentFolder = filePath.split('/').slice(-2, -1)[0]; + if (fileName && parentFolder && fileName.split('.')[0] === parentFolder) { + 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]; } => { + return { + label: label, + level: [2, 6] + }; + }, + + copyright: 'Copyright (C) 2020-2024 LiteyukiStudio. All Rights Reserved' } \ No newline at end of file diff --git a/docs/.vitepress/config/en.ts b/docs/.vitepress/config/en.ts index 56561b17..8edcfc7e 100755 --- a/docs/.vitepress/config/en.ts +++ b/docs/.vitepress/config/en.ts @@ -1,4 +1,5 @@ import {defineConfig} from 'vitepress' +import { ThemeConfig } from './common' export const en = defineConfig({ lang: "en-US", @@ -14,6 +15,7 @@ export const en = defineConfig({ {text: 'Usage', link: '/en/start/install'}, {text: 'Develop', link: '/en/dev/extension'}, ], + editLink: ThemeConfig.getEditLink('Edit this page'), langMenuLabel: 'Language', returnToTopLabel: 'To top', sidebarMenuLabel: 'Option', diff --git a/docs/.vitepress/config/index.ts b/docs/.vitepress/config/index.ts index ca4a88cf..e05f5696 100755 --- a/docs/.vitepress/config/index.ts +++ b/docs/.vitepress/config/index.ts @@ -36,4 +36,5 @@ export default defineConfig({ en: { label: "English", ...en }, ja: { label: "日本語", ...ja }, }, + lastUpdated: true, }) diff --git a/docs/.vitepress/config/ja.ts b/docs/.vitepress/config/ja.ts index 726889da..51bc0eb1 100755 --- a/docs/.vitepress/config/ja.ts +++ b/docs/.vitepress/config/ja.ts @@ -1,4 +1,5 @@ import {defineConfig} from 'vitepress' +import { ThemeConfig } from './common' export const ja = defineConfig({ lang: "ja-JP", @@ -14,6 +15,7 @@ export const ja = defineConfig({ {text: '使用方法', link: '/ja/start/install'}, {text: '開発', link: '/ja/dev/extension'}, ], + editLink: ThemeConfig.getEditLink('このページを編集'), langMenuLabel: '言語', returnToTopLabel: 'トップへ戻る', sidebarMenuLabel: 'オプション', diff --git a/docs/.vitepress/config/zh.ts b/docs/.vitepress/config/zh.ts index 896cb4ab..a3196706 100755 --- a/docs/.vitepress/config/zh.ts +++ b/docs/.vitepress/config/zh.ts @@ -1,4 +1,5 @@ import {defineConfig} from 'vitepress' +import { ThemeConfig } from './common' export const zh = defineConfig({ lang: "zh-Hans", @@ -14,6 +15,7 @@ export const zh = defineConfig({ {text: '使用', link: '/start/install'}, {text: '开发', link: '/dev/extension'}, ], + editLink: ThemeConfig.getEditLink('编辑此页面'), langMenuLabel: '语言', returnToTopLabel: '返回顶部', sidebarMenuLabel: '菜单', diff --git a/nonebot_plugin_marshoai/plugin/__init__.py b/nonebot_plugin_marshoai/plugin/__init__.py index 232f1a16..bffca6f8 100644 --- a/nonebot_plugin_marshoai/plugin/__init__.py +++ b/nonebot_plugin_marshoai/plugin/__init__.py @@ -8,4 +8,4 @@ from .load import * from .models import * from .utils import * -#logger.opt(colors=True).info("MarshoAI 插件功能开发中,用户请忽略相关日志") +# logger.opt(colors=True).info("MarshoAI 插件功能开发中,用户请忽略相关日志")