import {LiteralUnion, Nullable, Prettify} from '@pengzhanbo/utils' import {LocaleConfig, LocaleData, Page, PageData, PageFrontmatter} from 'vuepress' import {ReadingTime, ReadingTimePluginOptions} from '@vuepress/plugin-reading-time' import {MarkdownChartPluginOptions} from '@vuepress/plugin-markdown-chart' import {MarkdownHintPluginOptions} from '@vuepress/plugin-markdown-hint' import {MarkdownImagePluginOptions} from '@vuepress/plugin-markdown-image' import {MarkdownIncludePluginOptions} from '@vuepress/plugin-markdown-include' import {MarkdownMathPluginOptions} from '@vuepress/plugin-markdown-math' import {MarkdownPowerPluginOptions} from 'vuepress-plugin-md-power' import {SearchPluginOptions} from '@vuepress-plume/plugin-search' import { DocSearchOptions as DocSearchOptions$1, DocSearchPluginOptions, } from '@vuepress/plugin-docsearch' import * as THREE from 'three' import {CSSProperties} from 'vue' import {WatermarkPluginFrontmatter, WatermarkPluginOptions} from '@vuepress/plugin-watermark' import {TransformerRenderIndentGuidesOptions} from '@shikijs/transformers' import {CommentPluginOptions} from '@vuepress/plugin-comment' import {CopyCodePluginOptions} from '@vuepress/plugin-copy-code' import { ChangelogOptions, ContributorsOptions, GitChangelogInfo as GitChangelog, GitContributorInfo as GitContributor, GitPluginPageData, } from '@vuepress/plugin-git' import {LlmsPluginOptions} from '@vuepress/plugin-llms' import {ReplaceAssetsPluginOptions} from '@vuepress/plugin-replace-assets' import {ShikiPluginOptions} from '@vuepress/plugin-shiki' import {CachePluginOptions} from '@vuepress/plugin-cache' import {PhotoSwipePluginOptions} from '@vuepress/plugin-photo-swipe' import {SeoPluginOptions} from '@vuepress/plugin-seo' import {SitemapPluginOptions} from '@vuepress/plugin-sitemap' /** * Image configuration type * Supports simple string path or detailed configuration object * Also supports dark/light mode variants * * 图片配置类型 * 支持简单的字符串路径或详细的配置对象 * 同时支持深色/浅色模式变体 */ type ThemeImage = | string | { src: string alt?: string width?: string | number height?: string | number } | { dark: string light: string alt?: string width?: string | number height?: string | number } /** * Icon configuration type * Supports string name or inline SVG * * 图标配置类型 * 支持字符串名称或内联 SVG */ type ThemeIcon = | string | { svg: string } /** * Color configuration type * Supports single color or dark/light mode variants * * 颜色配置类型 * 支持单一颜色或深色/浅色模式变体 */ type ThemeColor = | string | { light: string dark: string } /** * Page outline navigation configuration * Controls the display of heading navigation in the sidebar * * 页面目录导航配置 * 控制侧边栏中标题导航的显示 * * - `false`: Disable outline / 禁用目录 * - `number`: Display headings up to this level / 显示到此级别的标题 * - `[number, number]`: Display headings within level range / 显示级别范围内的标题 * - `'deep'`: Display all headings including deeply nested ones / 显示所有标题,包括深层嵌套的 */ type ThemeOutline = false | number | [number, number] | 'deep' /** * Badge configuration interface * Defines the appearance of a badge element * * 徽章配置接口 * 定义徽章元素的外观 */ interface ThemeBadge { /** Badge text content / 徽章文本内容 */ text?: string /** Badge type for preset styles / 徽章类型,用于预设样式 */ type?: string /** Badge text color / 徽章文本颜色 */ color?: string /** Badge background color / 徽章背景颜色 */ bgColor?: string /** Badge border color / 徽章边框颜色 */ borderColor?: string } /** * Light/Dark mode value type * Supports single value or mode-specific values * * 浅色/深色模式值类型 * 支持单一值或模式特定的值 * * @template T - The value type / 值类型 */ type ThemeLightDark = | T | { light?: T dark?: T } /** * Read aid display mode * * 阅读辅助显示模式 * * @default 'left' */ type ThemeReadAid = 'left' | 'right' | 'mask' /** * Social link * * 社交链接 */ interface SocialLink { icon: SocialLinkIcon link: string ariaLabel?: string } /** * Social link icon * * 社交链接图标 */ type SocialLinkIcon = | LiteralUnion | { svg: string name?: string } /** * Social link icon type * * 社交链接图标类型 */ type SocialLinkIconUnion = | 'discord' | 'telegram' | 'facebook' | 'github' | 'instagram' | 'linkedin' | 'mastodon' | 'npm' | 'slack' | 'twitter' | 'x' | 'youtube' | 'qq' | 'weibo' | 'bilibili' | 'gitlab' | 'docker' | 'juejin' | 'zhihu' | 'douban' | 'steam' | 'stackoverflow' | 'xbox' | 'tiktok' | 'kuaishou' | 'bytedance' | 'xiaohongshu' | 'bluesky' | 'gmail' /** * Auto frontmatter data fields * * 自动 frontmatter 数据字段 */ type AutoFrontmatterData = Record, any> /** * The context of the markdown file * * markdown 文件的上下文 */ interface AutoFrontmatterContext { /** * The absolute path to the file * * 文件绝对路径 */ filepath: string /** * The relative path to the file * * 文件相对路径 */ relativePath: string /** * The markdown content of the file * * 文件 markdown 内容 */ content: string } /** * The function to handle the frontmatter data * * 处理 frontmatter 数据的函数 * * @example * ```ts * function transform(data, context) { * data.foo ??= 'foo' * return data * } * ``` */ type AutoFrontmatterHandle = ( data: D, context: AutoFrontmatterContext, ) => D | Promise /** * Auto frontmatter rule * * 自动 frontmatter 规则 */ interface AutoFrontmatterRule { /** * File filter, matches the relative path of the file * * Uses [picomatch](https://github.com/micromatch/picomatch) for pattern matching * * 文件过滤器,匹配文件的相对路径 * * 使用 [picomatch](https://github.com/micromatch/picomatch) 进行模式匹配 */ filter: string[] | string | ((relativePath: string) => boolean) /** * The function to handle the frontmatter data * * 处理 frontmatter 数据的函数 * * @example * ```ts * { * handle: (data, context) => { * data.foo ??= 'foo' * return data * } * } * ``` */ handle: AutoFrontmatterHandle } /** * Auto frontmatter options * * 自动 frontmatter 选项 */ interface AutoFrontmatterOptions { /** * 是否自动生成 permalink * * - `false`: 不自动生成 permalink * - `true`: 自动生成 permalink ,使用 nanoid 生成 8 位数随机字符串 * - `filepath`: 根据文件路径生成 permalink * * 对于 `filepath`,如果文件路径中包含中文,可以手动安装 `pinyin-pro` , * 主题内部会加载 `pinyin-pro` 进行中文拼音转换 * * @default true */ permalink?: boolean | 'filepath' /** * 是否自动生成 createTime * * 默认读取 文件创建时间,`createTime` 比 vuepress 默认的 `date` 时间更精准到秒 */ createTime?: boolean /** * 是否自动生成 title * * 默认读取文件名作为标题 */ title?: boolean /** * 自定义 frontmatter 生成函数 * * - 你应该直接将新字段添加到 `data` 中 * - 如果返回全新的 `data` 对象,会覆盖之前的 frontmatter * @param data 页面已存在的 frontmatter * @param context 当前页面的上下文信息 * @param locale 当前语言路径 * @returns 返回处理后的 frontmatter * * @example * ```ts * { * transform: (data, context, locale) => { * data.foo ??= 'foo' * return data * } * } * ``` */ transform?: ( data: AutoFrontmatterData, context: AutoFrontmatterContext, locale: string, ) => AutoFrontmatterData | Promise } /** * Bulletin board configuration * * 公告栏配置 */ interface BulletinOptions { /** * 公告位置 * @default 'top-right' */ layout?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center' /** * 是否显示渐变边框 * * @default true */ border?: boolean /** * 在哪些页面显示公告 * * - `true` 表示所有页面 * - `false` 表示不显示 * - 传入一个函数,返回 `true` 时显示 */ enablePage?: boolean | ((page: Page) => boolean) /** * 公告持续时间 * * @default 'always' * * - `'session'` 表示在会话周期内关闭公告后不再显示,在新的会话周期重新显示,刷新页面不会重新显示 * - `'always'` 表示总是显示,关闭公告后刷新页面会重新显示 * - `'once'` 表示在仅在当前周期内显示,关闭公告后不再显示,新的会话和刷新页面都不会重新显示 */ lifetime?: 'session' | 'always' | 'once' /** * 公告 ID * * 公告持续时间 需要根据 `id` 作为唯一标识 */ id?: string /** * 公告标题 */ title?: string /** * 公告内容 * * 可以使用 markdown 语法 或者 使用 html 文本, * 使用 markdown 时需要声明 `contentType` 为 `markdown` */ content?: string /** * 公告内容 类型 * * - `markdown` 表示使用 markdown 语法 * - `text` 表示使用 普通文本 (可以是 html 内容) * * @default 'text' */ contentType?: 'markdown' | 'text' /** * 传入一个 `markdown` 或 `html` 文件路径,并使用文件内容作为公告内容 * * - 使用 `.md` 文件时,将会解析 markdown 语法 * - 使用 `.html` 文件时,只能包含公告内容,请不要使用 `` `` `