UNPKG

hirsun-vuepress-theme-hope-plus

Version:
2,301 lines (2,253 loc) 64.8 kB
import { ThemeFunction, App, Plugin, Page, PluginObject, PluginConfig } from '@vuepress/core'; import { ThemeData as ThemeData$1 } from '@vuepress/plugin-theme-data'; import { FontIconAssets, BackToTopOptions, ComponentOptions } from 'vuepress-plugin-components'; import { Author, BasePageFrontMatter } from 'vuepress-shared'; import { GitPluginPageData, GitPluginOptions, GitData } from '@vuepress/plugin-git'; import { BlogPluginPageData, BlogOptions, BlogTypeOptions, BlogCategoryOptions } from 'vuepress-plugin-blog2'; import { ReadingTime, ReadingTimePluginPageData, ReadingTimeOptions } from 'vuepress-plugin-reading-time2'; import { SeoPluginPageData, SeoOptions } from 'vuepress-plugin-seo2'; import { LocaleData } from '@vuepress/shared'; import { AutoCatalogOptions } from 'vuepress-plugin-auto-catalog'; import { CommentPluginOptions, CommentOptions } from 'vuepress-plugin-comment2'; import { CopyCodeOptions } from 'vuepress-plugin-copy-code2'; import { CopyrightOptions } from 'vuepress-plugin-copyright2'; import { FeedOptions } from 'vuepress-plugin-feed2'; import { MarkdownEnhanceOptions } from 'vuepress-plugin-md-enhance'; import { PhotoSwipeOptions } from 'vuepress-plugin-photo-swipe'; import { PWAOptions } from 'vuepress-plugin-pwa2'; import { SitemapOptions } from 'vuepress-plugin-sitemap2'; import { UserConfig } from '@vuepress/cli'; interface HopeThemeBehaviorOptions { /** * Whether perform extra checks * * 是否执行额外检查 * * @default false */ check?: boolean; /** * Whether compact with historical versions * * 是否兼容历史版本 * * @default false */ compact?: boolean; /** * Whether enable customization * * 是否启用自定义 * * @default false */ custom?: boolean; /** * Whether enable debug mode * * 是否启用调试模式 * * @default false */ debug?: boolean; } declare const enum ArticleInfoType { type = "y", title = "t", shortTitle = "s", icon = "i", author = "a", date = "d", localizedDate = "l", category = "c", tag = "g", isEncrypted = "n", isOriginal = "o", readingTime = "r", excerpt = "e", sticky = "u", cover = "v", index = "I", order = "O" } declare const enum PageType { article = "a", home = "h", slide = "s", page = "p" } interface ArticleInfo extends Record<string, unknown> { /** * Type */ [ArticleInfoType.type]: PageType; /** * Article title */ [ArticleInfoType.title]: string; /** * Article short title */ [ArticleInfoType.shortTitle]: string; /** * Page icon */ [ArticleInfoType.icon]?: string; /** * Whether this page should be indexed * * used in other functions, e.g.: sidebar and catalog */ [ArticleInfoType.index]?: boolean; /** * The order of this page in same directory */ [ArticleInfoType.order]?: number; /** * Article author */ [ArticleInfoType.author]?: Author | false; /** * writing date info */ [ArticleInfoType.date]?: number; /** * writing date info in current language */ [ArticleInfoType.localizedDate]?: string; /** * article category */ [ArticleInfoType.category]?: string[]; /** * Article tag */ [ArticleInfoType.tag]?: string[]; /** * Reading time info */ [ArticleInfoType.readingTime]?: ReadingTime; /** * article excerpt */ [ArticleInfoType.excerpt]: string; /** * Whether is encrypted */ [ArticleInfoType.isEncrypted]?: true; /** * Whether is original */ [ArticleInfoType.isOriginal]?: true; /** * Sticky info */ [ArticleInfoType.sticky]?: number | boolean; /** * Cover image */ [ArticleInfoType.cover]?: string; } interface ThemePageFrontmatter extends BasePageFrontMatter { /** * Whether is home page * * 是否是主页 */ home?: boolean; /** * Whether enable navbar * * 是否启用导航栏 */ navbar?: boolean; /** * Sidebar configuration * * 侧边栏配置 */ sidebar?: "heading" | false; /** * Additional Class for Page container * * 页面容器的额外类名 */ containerClass?: string; } interface ThemeHopePageFrontmatter extends ThemePageFrontmatter { home: true; /** * @default false */ heroFullScreen?: boolean; heroImage?: string; heroImageDark?: string; heroImageStyle?: Record<string, string> | string; heroAlt?: string; heroText?: string; /** * Text array for typewriter effect * * 打字机效果的文字数组 */ heroTexts?: string[]; tagline?: string; bgImage?: string | false; bgImageDark?: string | false; bgImageStyle?: Record<string, string> | string; } interface ThemeBlogHomeProjectOptions { /** * Project name * * 项目名称 */ name: string; /** * Project description * * 项目描述 */ desc?: string; /** * Project link * * 项目链接 */ link: string; /** * Project icon * * @description image link or icon fontClass are supported, as well as `"link"`、`"project"`、`"book"`、`"article"`、`"friend"` * * 项目图标 * * @description 支持图片链接或者图标字体类,同时也支持 `"link"`、`"project"`、`"book"`、`"article"`、`"friend"` */ icon?: string; } interface ThemeBlogHomePageFrontmatter extends ThemeHopePageFrontmatter { layout: "BlogHome"; /** * @default true */ hero?: boolean; projects: ThemeBlogHomeProjectOptions[]; } /** * Type of page information * * 页面信息类型 */ type PageInfo = "Author" | "Category" | "Date" | "Original" | "PageView" | "Tag" | "ReadingTime" | "Word"; /** * Base link item, displayed as text */ interface TextItemOptions { /** * Text of item * * 项目文字 */ text: string; /** * Icon of item * * 项目图标 */ icon?: string; /** * Aria label of item * * 项目无障碍标签 */ ariaLabel?: string; } /** * Props for `<AutoLink>` */ interface AutoLinkOptions extends TextItemOptions { /** * link of item * * 当前页面链接 */ link: string; /** * Rel of `<a>` tag * * `<a>` 标签的 `rel` 属性 */ rel?: string; /** * Target of `<a>` tag * * `<a>` 标签的 `target` 属性 */ target?: string; /** * Regexp mode to be active * * 匹配激活的正则表达式 */ activeMatch?: string; } interface ThemeNormalPageFrontmatter extends ThemePageFrontmatter { /** * Whether is homepage * * 是否是主页 */ home?: false; /** * Whether index current page * * 是否索引此页面 * * @default true */ index?: boolean; /** * Page order in sidebar * * 页面在侧边栏的顺序 * * @default 0 */ order?: number; /** * Dir config * * @description Only available at README.md * * 目录配置 * * @description 仅在 README.md 中可用 */ dir?: { /** * Dir title * * @default title of README.md * * 目录标题 * * @default README.md 标题 */ text?: string; /** * Dir icon * * @default icon of README.md * * 目录图标 * * @default README.md 图标 */ icon?: string; /** * Whether Dir is collapsible * * 目录是否可折叠 * * @default true */ collapsible?: boolean; /** * Whether Dir is clickable * * @description Will set group link to link of README.md * * 目录是否可点击 * * @description 将会将目录分组的链接设置为 README.md 对应的链接 * * @default false */ link?: boolean; /** * Whether index current dir * * 是否索引此目录 * * @default true */ index?: boolean; /** * Dir order in sidebar * * 目录在侧边栏中的顺序 * * @default 0 */ order?: number; }; /** * A short title used in navbar, sidebar and breadcrumb * * 用于导航栏,侧边栏和路径导航的短标题 */ shortTitle?: string; /** * Page Heading depth * * 页面标题深度 */ headerDepth?: number; /** * Whether display lastUpdated time * * 是否显示最后更新事件 */ lastUpdated?: boolean; /** * Whether display contributors * * 是否显示贡献者 */ contributors?: boolean; /** * Whether show Edit link * * 是否显示编辑此页链接 */ editLink?: boolean; /** * Previous page link * * 上一页链接 */ prev?: string | AutoLinkOptions; /** * Next page link * * 下一页链接 */ next?: string | AutoLinkOptions; /** * Whether show toc list in desktop mode * * 是否在桌面模式下展示标题列表 */ toc?: boolean; /** * PageInfo items * * 页面信息项 * * @default ["Author", "Visitor", "Time", "Category", "Tag", "ReadTime"] */ pageInfo?: PageInfo[] | false; /** * Whether enable breadcrumb * * 是否启用路径导航 */ breadcrumb?: boolean; /** * Whether enable breadcrumb icon * * 是否启用路径导航图标 */ breadcrumbIcon?: boolean; /** * * Whether enable pageviews * * @description Only available when using artalk or waline comment service * * 是否启用访问量 * * @description 仅在使用 Artalk 或 Waline 评论服务时有效 * * @default true */ pageview?: boolean; /** * Whether this page is an article */ article?: boolean; /** * Whether the article be sticky in list * * If a number fill in, greater number will appear in front * * 是否置顶,如果填入数字,更大值会出现在前面 */ sticky?: boolean | number; /** * Whether the article be stared * * If a number fill in, greater number will appear in front * * 是否收藏,如果填入数字,更大值会出现在前面 */ star?: boolean | number; /** * Page excerpt * * 页面的摘要 */ excerpt?: string; } interface ThemeProjectHomeActionOptions { /** * Action name * * 操作名称 */ text: string; /** * Action link * * 操作链接 */ link: string; /** * Type of action * * 操作类型 * * @default "default" */ type?: "primary" | "default"; } interface ThemeProjectHomeHighlightItem { /** * Item name, supports HTML string * * 项目名称,支持 HTML 字符串 */ title: string; /** * Item description, supports HTML string * * 项目描述,支持 HTML 字符串 */ details?: string; /** * Item icon * * @description image link or icon fontClass are supported * * 项目图标 * * @description 支持图片链接或者图标字体类 */ icon?: string; /** * Item link * * 项目链接 */ link?: string; } type ThemeProjectHomeFeatureItem = ThemeProjectHomeHighlightItem; interface ThemeProjectHomeHighlightOptions { /** * Highlight section header, supports HTML string * * 亮点标题,支持 HTML 字符串 */ header: string; /** * Highlight section description, supports HTML string * * 亮点描述,支持 HTML 字符串 */ description?: string; /** * Text color * * 文字颜色 */ color?: string; /** * Highlight section image * * 亮点图像 */ image?: string; /** * Highlight section image used in darkmode * * 夜间模式使用的亮点图片 * * @default image */ imageDark?: string; /** * Highlight Background image * * 亮点背景图 */ bgImage?: string; /** * Highlight Background image used in darkmode * * 夜间模式使用的亮点背景图 * * @default bgImage */ bgImageDark?: string; /** * Highlight Background image style * * 亮点背景图样式 */ bgImageStyle?: Record<string, string> | string; /** * Highlight section list type * * 亮点列表类型 * * @default un-order */ type?: "order" | "un-order" | "no-order"; /** * Highlights * * 亮点 */ highlights?: ThemeProjectHomeHighlightItem[]; } interface ThemeProjectHomeFeatureOptions { /** * Feature header * * 功能标题 */ header?: string; /** * Feature section description, supports HTML string * * 功能描述,支持 HTML 字符串 */ description?: string; /** * Text color * * 文字颜色 */ color?: string; /** * Feature section image * * 功能图像 */ image?: string; /** * Feature section image used in darkmode * * 夜间模式使用的功能图片 * * @default image */ imageDark?: string; /** * Feature Background image * * 功能背景图 */ bgImage?: string; /** * Feature Background image used in darkmode * * 夜间模式使用的功能背景图 * * @default bgImage */ bgImageDark?: string; /** * Feature Background image style * * 功能背景图样式 */ bgImageStyle?: Record<string, string> | string; /** * Features * * 功能 */ features: ThemeProjectHomeFeatureItem[]; } interface ThemeProjectHomePageFrontmatter extends ThemeHopePageFrontmatter { actions?: ThemeProjectHomeActionOptions[]; features?: ThemeProjectHomeFeatureItem[]; highlights?: (ThemeProjectHomeFeatureOptions | ThemeProjectHomeHighlightOptions)[]; } /** * Base nav group, has nav items children */ interface NavGroup<T> extends TextItemOptions { /** * Link prefix of current group * * 当前分组的页面前缀 */ prefix?: string; /** * Link of current group * * 当前分组的链接 */ link?: string; /** * Children of current group * * 当前分组的子项 */ children: T[]; } /** * Navbar types */ type NavbarItem = AutoLinkOptions; type NavbarGroup = NavGroup<NavbarGroup | NavbarItem | string>; type NavbarOptions = (NavbarItem | NavbarGroup | string)[]; type DarkmodeOptions = "switch" | "auto" | "toggle" | "enable" | "disable"; interface OutlookLocaleData { /** * Theme Color */ themeColor: string; /** * Theme mode */ darkmode: string; /** * Theme mode */ fullscreen: string; } interface AppearanceLocaleData { outlookLocales: { /** * Theme Color * * 主题色 */ themeColor: string; /** * Theme mode * * 夜间模式 */ darkmode: string; /** * Fullscreen text * * 全屏文字 */ fullscreen: string; }; } /** * @kind root */ interface AppearanceOptions { /** * Whether enable pure mode * * 是否开启纯净模式 * * @default false */ pure?: boolean; /** * Dark mode support options: * * - `"switch"`: switch between dark, light and auto (default) * - `"toggle"`: toggle between lightmode and darkmode * - `"auto"`: Automatically decide whether to apply dark mode based on user device’s color-scheme or current time * - `"enable"`: only dark mode * - `"disable"`: disable dark mode * * 深色模式支持选项: * * - `"switch"`: 在深色模式,浅色模式和自动之间切换 (默认) * - `"toggle"`: 在深色模式和浅色模式之间切换 * - `"auto"`: 自动根据用户设备主题或当前时间决定是否应用深色模式 * - `"enable"`: 强制深色模式 * - `"disable"`: 禁用深色模式 * * @default "auto-switch" */ darkmode?: DarkmodeOptions; /** * Whether enable theme color picker * * 是否启用主题色选择器 * * @default false */ themeColor?: boolean; /** * Whether display print button in desktop mode * * 是否在桌面模式下显示打印按钮 * * @default true */ print?: boolean; /** * Full screen button * * 全屏按钮 * * @default false */ fullscreen?: boolean; /** * Link of font icon asset * * 字体图标资源链接 * * @description `"iconfont"` and `"fontawesome"` keywords are supported */ iconAssets?: FontIconAssets; /** * Font Icon class prefix * * 字体图标 class 前缀 * * @default "" */ iconPrefix?: string; } type AppearanceConfig = AppearanceOptions; interface BlogLocaleData extends Record<string, string> { /** 文章文字 */ article: string; /** 文章列表文字 */ articleList: string; /** 分类文字 */ category: string; /** 标签文字 */ tag: string; /** 时间轴文字 */ timeline: string; /** 时间轴标题文字 */ timelineTitle: string; /** 全部文字 */ all: string; /** 个人介绍 */ intro: string; /** 收藏文字 */ star: string; } interface PaginationLocaleData { /** * Previous page button label text * * 上一页文字 */ prev: string; /** * Next page button label text * * 下一页文字 */ next: string; /** * Navigation hint label text * * 跳转提示文字 */ navigate: string; /** * Navigation button label text * * 跳转按钮文字 */ action: string; /** * Error text when invalid page number * * @description `$page` will be replaced by total page number automatically * * 页码错误文字 * * @description 其中 `$page` 会自动替换为当前的总页数 */ errorText: string; } /** * 博客选项 * * Blog configuration * * @kind locale */ interface BlogLocaleOptions { /** * Name of the Blogger * * 博主名称 * * @default themeConfig.author */ name?: string; /** * Blogger avatar, must be an absolute path * * 博主头像,应为绝对路径 * * @default themeConfig.navbar.logo */ avatar?: string; /** * Motto, slogan or a short description * * 口号、座右铭或介绍语 */ description?: string; /** * Blogger introduction page link * * 博主的个人介绍页地址 */ intro?: string; /** * 媒体链接配置 * * Media links configuration * * @example * * ```js * { * QQ: "http://wpa.qq.com/msgrd?v=3&uin=1178522294&site=qq&menu=yes", * Qzone: "https://1178522294.qzone.qq.com/", * Gmail: "mailto:mister-hope@outlook.com", * Zhihu: "https://www.zhihu.com/people/mister-hope", * Steam: "https://steamcommunity.com/id/Mr-Hope/", * Weibo: "https://weibo.com/misterhope", * } * ``` */ medias?: Record<string, [string, string] | string>; /** * Whether clipping the avatar with round shape * * 是否剪裁头像为圆形形状 * * @default false */ roundAvatar?: boolean; /** * Whether to display blogger info in sidebar * * 是否在侧边栏展示博主信息 * * @default "mobile" */ sidebarDisplay?: "mobile" | "none" | "always"; /** * Custom text for timeline * * 时间轴自定义文字 * * @default "Yesterday once more" */ timeline?: string; /** * Article number per page * * 每页的文章数量 * * @default 10 */ articlePerPage?: number; /** * Article info displayed in article list * * 文章列表中展示的文章信息 * * @default ["Author", "Original", "Date", "PageView", "ReadingTime", "Category", "Tag"] */ articleInfo?: PageInfo[]; } interface BlogLocaleConfig extends Omit<BlogLocaleOptions, "media"> { medias?: Record<string, string>; } interface EncryptLocaleData { /** * Aria label for encrypt icon * * 加密图标的无障碍标签 */ iconLabel: string; /** * Password placeholder * * 密码输入框的默认占位符 */ placeholder: string; /** * Whether remember password * * 是否记忆密码 */ remember: string; /** * Password error hint * * 密码错误提示 */ errorHint: string; } /** * Encrypt Options * * 加密选项 * * @kind root */ interface EncryptOptions { /** * Whether encrypt globally * * 是否全局加密 * * @default false */ global?: boolean; /** * Admin passwords, which has the highest authority * * 最高权限密码 */ admin?: string | string[]; /** * Encrypt Configuration * * @example * * ```json * { * // This will encrypt the entire guide directory and both passwords will be available * "/guide/": ["1234", "5678"], * // this will only encrypt config/page.html * "/config/page.html": "1234" * } * ``` * * 加密配置 * * @example * * ```json * { * // 这会加密整个 guide 目录,并且两个密码都是可用的 * "/guide/": ["1234", "5678"], * // 这只会加密 config/page.html * "/config/page.html": "1234" * } * ``` */ config?: Record<string, string | string[]>; } /** * Encrypt Config * * 加密配置 * * @kind root */ interface EncryptConfig { /** * Whether encrypt globally * * 是否全局加密 * * @default false */ global?: boolean; /** * Admin passwords, which has the highest authority * * 最高权限密码 */ admin?: string[]; /** * Encrypt Configuration * * 加密配置 */ config?: Record<string, string[]>; } interface FeatureLocaleData { /** * Blog related i18n config * * 博客相关多语言配置 */ blogLocales: BlogLocaleData; /** * Pagination related i18n config * * 分页相关多语言配置 */ paginationLocales: PaginationLocaleData; /** * Encrypt related i18n config * * 加密相关多语言配置 */ encryptLocales: EncryptLocaleData; } interface FeatureLocaleOptions { /** * Blog feature options * * 博客功能配置 */ blog?: BlogLocaleOptions; } interface FeatureLocaleConfig { blog?: BlogLocaleConfig; } /** * @kind root */ interface FeatureOptions { /** * Encrypt config * * 加密配置 */ encrypt?: EncryptOptions; /** * Whether enable hotReload for features that requires app to restart * * @description These features includes blog support and structure sidebar feature * * 是否为需要重启整个 app 的功能启用热更新 * * @description 这些功能包括博客支持和结构侧边栏功能 * * @default app.env.isDebug */ hotReload?: boolean; } interface FeatureConfig extends FeatureLocaleConfig { /** * Encrypt config * * 加密配置 */ encrypt: EncryptConfig; } /** * 页脚选项 * * Footer options */ interface FooterLocaleOptions { /** * The default content for the footer, supports HTMLString. * * 页脚的默认内容,支持 HTMLString */ footer?: string; /** * The default copyright info, set it to `false` to disable it by default. * * 默认的版权信息,设置为 `false` 来默认禁用它 */ copyright?: string | false; /** * Whether to display footer by default * * 是否默认显示页脚 * * @default false */ displayFooter?: boolean; } interface DocsRepoLocaleOptions { /** * Pattern of edit link, we provide built-in support for GitHub, Gitlab, Gitee, Bitbucket * * 编辑链接的匹配,我们已经为 GitHub、Gitlab、Gitee 和 Bitbucket 提供了内置支持 * * @example ":repo/edit/:branch/:path" */ editLinkPattern?: string; /** * The repo of your docs * * 文档仓库 * * @default themeConfig.repo */ docsRepo?: string; /** * The branch of your docs * * 文档所在分支 * * @default "main" */ docsBranch?: string; /** * Docs dir location in repo * * 文档在仓库中的目录 * * @default "" */ docsDir?: string; } interface MetaLocateData { /** * Author label text * * 作者文字 */ author: string; /** * Writing date label text * * 写作日期文字 */ date: string; /** * Label text marked as original * * 标记原创的文字 */ origin: string; /** * Page views label text * * 访问量文字 */ views: string; /** * Tag label text * * 标签文字 */ tag: string; /** * Category label text * * 分类文字 */ category: string; /** * Expect reading time label text * * 期望阅读时间文字 */ readingTime: string; /** * Words label Text * * 文章字数 */ words: string; /** * Table of contents * * 此页内容 */ toc: string; /** * Previous link * * 上一页 */ prev: string; /** * Next link * * 下一页 */ next: string; /** * Last updated Text * * 最后更新时间 */ lastUpdated: string; /** * Contributors text * * 贡献者 */ contributors: string; /** * Edit link text * * 编辑此页 */ editLink: string; /** * Print button * * 打印按钮 */ print: string; } interface MetaLocaleOptions { /** * Whether to show "Last Updated" or not * * 是否显示页面最后更新时间 * * @default true */ lastUpdated?: boolean; /** * Whether to show "Contributors" or not * * 是否显示页面贡献者 * * @default true */ contributors?: boolean; /** * Whether to show "Edit this page" or not * * 是否展示编辑此页链接 * * @default true */ editLink?: boolean; } interface NavbarLocaleData { /** * Aria label of of the language selection dropdown * * 语言下拉列表的无障碍标签 */ selectLangAriaLabel: string; /** * Language name of current locale * * 当前语言的名称 */ langName: string; } /** * Navbar component * * 导航栏组件 */ type NavbarComponent = "Brand" | "Links" | "Language" | "Search" | "Outlook" | "Repo"; /** * Navbar layout options * * 导航栏布局选项 */ interface NavbarLayoutOptions { start?: (NavbarComponent | string)[]; center?: (NavbarComponent | string)[]; end?: (NavbarComponent | string)[]; } interface NavbarLocaleOptions { /** * Navbar config * * @description Set to `false` to disable navbar in current locale * * @see https://theme-hope.vuejs.press/guide/layout/navbar.html * * 导航栏配置 * * @description 设置 `false` 以在当前语言中禁用导航栏 * * @see https://theme-hope.vuejs.press/v2/zh/guide/layout/navbar.html */ navbar?: NavbarOptions | false; /** * Navbar logo * * @description should be absolute path relative to `.vuepress/public` folder * * 导航栏图标 * * @description 应为基于 `.vuepress/public` 文件夹的绝对路径 */ logo?: string; /** * Navbar logo under darkmode * * @description should be absolute path relative to `.vuepress/public` folder * * 夜间模式下导航栏图标 * * @description 应为基于 `.vuepress/public` 文件夹的绝对路径 */ logoDark?: string; /** * Navbar title * * 导航栏标题 * * @default $siteLocale.title */ navTitle?: string | false; /** * Repository link * * 仓库链接 */ repo?: string; /** * Whether display repo link in navbar. * * 是否在导航栏显示仓库链接。 * * @default true */ repoDisplay?: boolean; /** * Repository aria label of navbar * * 导航栏仓库按钮的无障碍标签 */ repoLabel?: string; /** * Whether show icon in navbar * * 是否在导航栏中显示图标 * * @default true */ navbarIcon?: boolean; /** * Whether to hide navbar when scrolling down * * 是否在向下滚动时自动隐藏导航栏 * * @default "mobile" */ navbarAutoHide?: "always" | "mobile" | "none"; /** * Navbar layout config * * 导航栏布局设置 * * @default { start: ["Brand"], center: ["Links"], end: ["Language", "Repo", "Outlook", "Search"] } */ navbarLayout?: NavbarLayoutOptions; /** * Whether hide site title on mobile * * 是否在移动视图下隐藏站点名称 * * @default true */ hideSiteNameOnMobile?: boolean; } interface RouteLocaleData { /** * Skip to main content */ skipToContent: string; /** * 404 page title * * 404 页面的标题 */ notFoundTitle: string; /** * 404 page msgs * * 404 页面的提示信息 */ notFoundMsg: string[]; /** * Back to homepage * * 返回主页 */ home: string; /** * Back to last page * * 返回上一页 */ back: string; /** * screen reader only message in `<ExternalLinkIcon>` * * 在 `<ExternalLinkIcon>` 中的屏幕阅读器消息 */ openInNewWindow: string; } interface ThemePageData extends BlogPluginPageData, Partial<GitPluginPageData>, Partial<ReadingTimePluginPageData>, Partial<SeoPluginPageData> { filePathRelative: string | null; } type SidebarPageItem = AutoLinkOptions; interface SidebarStructureItem extends TextItemOptions { /** * Link prefix of current group * * 当前分组的页面前缀 */ prefix?: string; /** * Link of current group * * 当前分组的链接 */ link?: string; /** * Whether current group is collapsible * * 当前分组的链接是否可折叠 * * @default false */ collapsible?: boolean; children: "structure"; } interface SidebarGroupItem extends TextItemOptions { /** * Link prefix of current group * * 当前分组的页面前缀 */ prefix?: string; /** * Link of current group * * 当前分组的链接 */ link?: string; /** * Whether current group is collapsible * * 当前分组的链接是否可折叠 * * @default false */ collapsible?: boolean; /** * Children of current group * * 当前分组的子项 */ children: (SidebarPageItem | SidebarGroupItem | SidebarStructureItem | string)[]; } type SidebarItem = SidebarPageItem | SidebarGroupItem | SidebarStructureItem | string; type SidebarArrayOptions = SidebarItem[]; type SidebarObjectOptions = Record<string, SidebarArrayOptions | "structure" | "heading" | false>; type SidebarOptions = SidebarArrayOptions | SidebarObjectOptions | "structure" | "heading" | false; interface SidebarFileInfo { type: "file"; filename: string; title: string; order: number | null; path?: string | null; frontmatter: ThemeNormalPageFrontmatter; pageData: ThemePageData; } interface SidebarDirInfo { type: "dir"; dirname: string; children: SidebarInfo[]; title: string; order: number | null; groupInfo: { icon?: string; collapsible?: boolean; link?: string; }; frontmatter: ThemeNormalPageFrontmatter | null; pageData: ThemePageData | null; } type SidebarInfo = SidebarFileInfo | SidebarDirInfo; type SidebarSorterKeyword = "readme" | "order" | "date" | "date-desc" | "filename" | "title"; type SidebarSorterFunction = (infoA: SidebarInfo, infoB: SidebarInfo) => number; type SidebarSorter = SidebarSorterFunction | SidebarSorterFunction[] | SidebarSorterKeyword | SidebarSorterKeyword[]; interface SidebarLocaleOptions { /** * sidebar config * * @description Set to `false` to disable sidebar in current locale * @see https://theme-hope.vuejs.press/guide/layout/sidebar.html * * 侧边栏配置 * * @description 设置为 `false` 以在当前语言中禁用侧边栏 * @see https://theme-hope.vuejs.press/zh/guide/layout/sidebar.html */ sidebar?: SidebarOptions; /** * Whether show icons in the sidebar * * 是否在侧边栏显示图标 * * @default true */ sidebarIcon?: boolean; /** * Heading depth for sidebar and toc * * - Set to `0` to disable all levels * - Set to `1` to include `<h2>` * - Set to `2` to include `<h2>` and `<h3>` * - ... * * The max value depends on which headers you have extracted * via `markdown.headers.level`. * * The default value of `markdown.headers.level` is `[2, 3]`, * so the default max value of `headerDepth` is `2` * * 侧边栏和页面目录的标题深度 * * - 设置 `0` 来禁用所有级别的标题 * - 设置 `1` 来包含 `<h2>` * - 设置 `2` 来包含 `<h2>` 和 `<h3>` * - ... * * `markdown.headers.level` 的默认值是 `[2, 3]`, * 所以 `headerDepth` 的默认最大值是 `2` * * @default 2 */ headerDepth?: number; } interface LayoutLocaleData { /** * Navbar related i18n config */ navbarLocales: NavbarLocaleData; /** * Meta related i18n config */ metaLocales: MetaLocateData; /** * Router related i18n config */ routeLocales: RouteLocaleData; } interface LayoutLocaleOptions extends NavbarLocaleOptions, SidebarLocaleOptions, DocsRepoLocaleOptions, MetaLocaleOptions, FooterLocaleOptions { /** * Home path of current locale * * @description Used as the link of back-to-home and navbar logo * * 当前语言的主页路径 * * @description 用于导航栏图标和返回主页按钮的链接 */ home?: string; /** * Whether enable breadcrumb globally * * 是否全局启用路径导航 * * @default true */ breadcrumb?: boolean; /** * Whether display icon in breadcrumb * * 是否在路径导航显示图标 * * @default true */ breadcrumbIcon?: boolean; /** * Whether display icon besides page title * * 是否在页面标题旁显示图标 * * @default true */ titleIcon?: boolean; /** * Article Info display configuration * * @see https://theme-hope.vuejs.press/guide/feature/page-info.html * * 文章信息配置 * * @see https://theme-hope.vuejs.press/zh/guide/feature/page-info.html * * @default ["Author", "Original", "Date", "PageView", "ReadingTime", "Category", "Tag"] */ pageInfo?: PageInfo[] | false; /** * Whether show toc list in desktop mode * * 是否在桌面模式下展示标题列表 */ toc?: boolean; /** * Whether rtl layout should be used * * 是否使用 rtl 布局 */ rtl?: boolean; /** * Whether display nextLink * * 是否显示 下一篇 链接 * * @default true */ nextLink?: boolean; /** * Whether display prevLink * * 是否显示 上一篇 链接 * * @default true */ prevLink?: boolean; } type LayoutLocaleConfig = LayoutLocaleOptions; /** * @kind root */ interface LayoutOptions { /** * Wether display back to top button * * 是否显示返回顶部按钮 * * @default true */ backToTop?: BackToTopOptions | boolean; /** * Sorter of structure sidebar * * 结构化侧边栏排序器 * * @default ["readme", "index", "title", "filename"] */ sidebarSorter?: SidebarSorter; } interface InfoOptions { /** * Site favicon * * 站点图标 */ favicon?: string; /** * Global default author * * 全局默认作者 */ author?: Author; /** * domain which to be deployed to * * 网站部署域名 */ hostname?: string; /** * Extra i18n sites * * @description key is the name of language, and value is the path of site, `:route` will be replaced by current route * * 额外的多语言站点 * * @description 键是语言的名称,值是站点的路径,`:route` 会被替换为当前路由 */ extraLocales?: Record<string, string>; } type LocaleDataToOption<T> = { [P in keyof T]?: Partial<T[P]>; }; interface ThemeLocaleData extends AppearanceLocaleData, FeatureLocaleData, LayoutLocaleData { /** * Current lang code */ lang: string; } interface ThemeLocaleOptions extends LocaleData, LocaleDataToOption<AppearanceLocaleData>, LocaleDataToOption<FeatureLocaleData>, FeatureLocaleOptions, LocaleDataToOption<LayoutLocaleData>, LayoutLocaleOptions { /** * Global default author * * 全局默认作者 */ author?: Author; } interface ThemeLocaleConfig extends LocaleData, ThemeLocaleData, FeatureLocaleConfig, LayoutLocaleConfig { /** * Global default author * * 全局默认作者 */ author?: Author; } interface BlogPluginOptions extends Partial<Pick<BlogOptions, "excerptFilter" | "excerptLength" | "excerptSeparator" | "filter" | "hotReload">> { /** * Path of article list * * 文章列表的路径 * * @default "/article/" */ article?: string; /** * Path of category map * * 分类地图页的地址 * * @default "/category/" */ category?: string; /** * Path to navigate when clicking category label * * `:name` will be automatically replaced by current category name * * 点击分类标签时跳转的路径。 * * 其中 `:name` 会被自动替换为当前分类名称 * * @default "/category/:name/" */ categoryItem?: string; /** * Path of tag map * * 标签地图页的地址 * * @default "/tag/" */ tag?: string; /** * Path to navigate when clicking tag label * * `:name` will be automatically replaced by current tag name * * 点击标签跳转的路径。 * * 其中 `:name` 会被自动替换为当前分类名称 * * @default "/tag/:name/" */ tagItem?: string; /** * Path of star article list * * 星标文章列表的路径 * * @default "/star/"" */ star?: string; /** * Path of timeline * * 时间线路径 * * @default "/timeline/" */ timeline?: string; /** * Excerpt generation * * 摘要生成 * * @default true */ excerpt?: boolean; /** * Additional Article Type * * @description This is an advanced option, please refer to the [blog2 plugin documentation](https://plugin-blog.vuejs.press/guide.html#customizing-categories-and-types) for details * * 额外的文章类型 * * @description 这是一个高级选项,请参考 [blog2 插件文档](https://plugin-blog.vuejs.press/zh/guide.html#%E8%87%AA%E5%AE%9A%E4%B9%89%E7%B1%BB%E5%88%AB%E5%92%8C%E7%B1%BB%E5%9E%8B) 了解详情 * * @default [] */ type?: BlogTypeOptions[]; } type PrismjsLightTheme = "ateliersulphurpool-light" | "coldark-cold" | "coy" | "duotone-light" | "ghcolors" | "gruvbox-light" | "material-light" | "one-light" | "vs"; type PrismjsDarkTheme = "atom-dark" | "cb" | "coldark-dark" | "dark" | "dracula" | "duotone-dark" | "duotone-earth" | "duotone-forest" | "duotone-sea" | "duotone-space" | "gruvbox-dark" | "holi" | "hopscotch" | "lucario" | "material-dark" | "material-oceanic" | "night-owl" | "nord" | "one-dark" | "pojoaque" | "shades-of-purple" | "solarized-dark-atom" | "tomorrow" | "vsc-dark-plus" | "xonokai" | "z-touch"; type PrismjsTheme = PrismjsDarkTheme | PrismjsLightTheme; interface PrismjsOptions { /** * light theme * * @default 'one-light' */ light?: PrismjsTheme; /** * dark theme * @default 'one-dark' */ dark?: PrismjsTheme; } interface PluginsOptions { /** * Enable @vuepress/active-header-links or not * * 是否启用 @vuepress/active-header-links 插件 * * @default true */ activeHeaderLinks?: boolean; /** * Auto catalog plugin Options * * 自动目录插件选项 * * @default true */ autoCatalog?: AutoCatalogOptions | boolean; /** * Blog plugin options * * 博客插件选项 * * @default false */ blog?: BlogPluginOptions | boolean; /** * Components enabled * * @description FontIcon is used internally, so it will be registered anyway. * * @see https://plugin-components.vuejs.press/config.html * * 需要启用的插件 * * @description FontIcon 被内部使用,所以它无论如何都会被注册。 * * @see https://plugin-components.vuejs.press/zh/config.html */ components?: ComponentOptions; /** * Comment plugin options * * @see https://plugin-comment2.vuejs.press/config/ * * 评论插件配置 * * @see https://plugin-comment2.vuejs.press/zh/config/ */ comment?: CommentPluginOptions | false; /** * code copy plugin options * * @see https://plugin-copy-code2.vuejs.press/config/ * * 代码复制插件配置 * * @see https://plugin-copy-code2.vuejs.press/zh/config/ */ copyCode?: CopyCodeOptions | false; /** * Copyright Plugin options * * @see https://plugin-copyright2.vuejs.press/config.html * * 版权信息插件配置 * * @see https://plugin-copyright2.vuejs.press/zh/config.html * * @default false */ copyright?: CopyrightOptions | boolean; /** * Enable @vuepress/external-link-icon or not * * 是否启用 @vuepress/external-link-icon 插件 * * @default true */ externalLinkIcon?: boolean; /** * Feed plugin options * * @see https://plugin-feed2.vuejs.press/config/ * * Feed 插件配置 * * @see https://plugin-feed2.vuejs.press/zh/config/ */ feed?: Omit<FeedOptions, "hostname">; /** * Git plugin options * * @description By default this plugin is only enabled in production mode for performance reasons. * * @see https://vuejs.press/reference/plugin/git.html * * Git 插件配置 * * @description 默认情况下,出于性能原因,此插件仅在生产模式下启用。 * * @see https://vuejs.press/zh/reference/plugin/git.html */ git?: GitPluginOptions | boolean; /** * md-enhance plugin options * * @see https://plugin-md-enhance.vuejs.press/config/ * * md-enhance 插件配置 * * @see https://plugin-md-enhance.vuejs.press/zh/config/ */ mdEnhance?: (Omit<MarkdownEnhanceOptions, "container"> & { /** * Whether to enable custom container including * * - info * - note * - tip * - warning * - danger * - details * * ⚠ The last 4 items conflict with default theme and will override it’s style. * * 是否启用自定义容器 * * - info * - note * - tip * - warning * - danger * - details * * ⚠ 最后四个会和默认主题冲突,且会覆盖默认主题的样式与行为。 * * @default true */ container?: boolean; }) | false; /** * Enable @vuepress/nprogress or not * * 是否启用 @vuepress/nprogress 插件 * * @default true */ nprogress?: boolean; /** * Photo Swipe plugin options * * @description This plugin is enabled by default * * @see https://plugin-photo-swipe.vuejs.press/config/ * * 图片预览插件配置 * * @see https://plugin-photo-swipe.vuejs.press/zh/config/ * * @default true */ photoSwipe?: PhotoSwipeOptions | boolean; /** * Enable @vuepress/prismjs or not * * 是否启用 @vuepress/prismjs 插件 * * @default true */ prismjs?: PrismjsOptions | boolean; /** * PWA plugin options * * @see https://plugin-pwa2.vuejs.press/config/ * * PWA 插件配置 * * @see https://plugin-pwa2.vuejs.press/zh/config/ * * @default false */ pwa?: PWAOptions | boolean; /** * ReadingTime options * * @see https://plugin-reading-time2.vuejs.press/ * * 阅读时间插件配置 * * @see https://plugin-reading-time2.vuejs.press/zh/ * * @default true */ readingTime?: ReadingTimeOptions | boolean; /** * SEO plugin options * * @see https://plugin-seo2.vuejs.press/config/ * * SEO 插件配置 * * @see https://plugin-seo2.vuejs.press/zh/config/ * * @default true */ seo?: Omit<SeoOptions, "hostname" | "author"> | boolean; /** * Sitemap plugin options * * @see https://plugin-sitemap2.vuejs.press/config/ * * Sitemap 插件配置 * * @see https://plugin-sitemap2.vuejs.press/zh/config/ * * @default true */ sitemap?: Omit<SitemapOptions, "hostname"> | boolean; } interface ThemeOptions extends AppearanceOptions, FeatureOptions, InfoOptions, LayoutOptions, ThemeData$1<ThemeLocaleOptions> { plugins?: PluginsOptions; } interface ThemeData extends AppearanceConfig, FeatureConfig, InfoOptions { locales: Record<string, ThemeLocaleConfig>; } type Helper<T> = (options: T) => T; type ThemeNavbarHelper = Helper<NavbarOptions>; type ThemeSidebarHelper = Helper<SidebarOptions>; type ThemeSidebarArrayHelper = Helper<SidebarArrayOptions>; type ThemeSidebarObjectHelper = Helper<SidebarObjectOptions>; type ThemeBlogPluginHelper = Helper<BlogPluginOptions | boolean>; type ThemeCommentPluginHelper = Helper<CommentOptions | false>; type ThemeCopyCodePluginHelper = Helper<CopyCodeOptions | false>; type ThemeCopyrightPluginHelper = Helper<CopyrightOptions | false>; type ThemeFeedPluginHelper = Helper<Omit<FeedOptions, "hostname"> | false>; type ThemeGitPluginHelper = Helper<GitPluginOptions | false>; type ThemeMdEnhancePluginHelper = Helper<MarkdownEnhanceOptions | false>; type ThemePhotoSwipePluginHelper = Helper<PhotoSwipeOptions | false>; type ThemePWAPluginHelper = Helper<PWAOptions | false>; type ThemeReadingTimePluginHelper = Helper<ReadingTimeOptions | false>; type ThemeSEOPluginHelper = Helper<Omit<SeoOptions, "hostname" | "author"> | false>; type ThemeSitemapPluginHelper = Helper<Omit<SitemapOptions, "hostname"> | false>; declare const hopeTheme: (options: ThemeOptions, behavior?: HopeThemeBehaviorOptions | boolean) => ThemeFunction; /** * @deprecated You should use V2 standard frontmatter and avoid using it */ declare const convertFrontmatter: (frontmatter: Record<string, unknown>, filePathRelative?: string | null) => ThemePageFrontmatter & Record<string, unknown>; /** * @deprecated use `import { navbar } from "vuepress-theme-hope";` instead */ declare const navbarConfig: (config: NavbarOptions) => NavbarOptions; /** * @deprecated use `import { arraySidebar } from "vuepress-theme-hope";` instead */ declare const sidebarConfig: (config: SidebarOptions) => SidebarOptions; /** * @deprecated use `import { hopeThemeLegacy } from "vuepress-theme-hope";` instead */ declare const themeConfig: (themeConfig: ThemeOptions) => ThemeOptions; /** * @deprecated import and use `hopeTheme` instead */ declare const config: (userConfig: Record<string, unknown>) => UserConfig; /** * @deprecated use `import { navbar } from "vuepress-theme-hope";` instead */ declare const defineNavbarConfig: (config: NavbarOptions) => NavbarOptions; /** * @deprecated use `import { sidebar } from "vuepress-theme-hope";` instead */ declare const defineSidebarConfig: (config: SidebarOptions) => SidebarOptions; /** * @deprecated use `import { arraySidebar } from "vuepress-theme-hope";` instead */ declare const defineSidebarArrayConfig: (config: SidebarArrayOptions) => SidebarArrayOptions; /** * @deprecated use `import { objectSidebar } from "vuepress-theme-hope";` instead */ declare const defineSidebarObjectConfig: (config: SidebarObjectOptions) => SidebarObjectOptions; /** * @deprecated use `import { hopeThemeLegacy } from "vuepress-theme-hope";` instead */ declare const defineThemeConfig: (themeConfig: ThemeOptions) => ThemeOptions; /** * @deprecated import and use `hopeTheme` instead */ declare const defineHopeConfig: (config: UserConfig & Record<string, unknown>) => UserConfig; /** * @deprecated You should use V2 standard navbar config and avoid using it */ declare const convertNavbarOptions: (config: NavbarOptions | unknown) => NavbarOptions | false; /** * @deprecated You should use V2 standard sidebar config and avoid using it */ declare const convertSidebarOptions: (config: SidebarOptions | unknown) => SidebarOptions | false; /** * @deprecated You should use scss style files in v2 and avoid using it */ declare const checkLegacyStyle: (app: App) => void; /** * @deprecated You should use V2 standard options and avoid using it */ declare const convertThemeOptions: (themeOptions: Record<string, unknown>) => ThemeOptions; declare const navbar: ThemeNavbarHelper; declare const sidebar: ThemeSidebarHelper; declare const arraySidebar: ThemeSidebarArrayHelper; declare const objectSidebar: ThemeSidebarObjectHelper; declare const blog: ThemeBlogPluginHelper; declare const comment: ThemeCommentPluginHelper; declare const copyCode: ThemeCopyCodePluginHelper; declare const copyright: ThemeCopyrightPluginHelper; declare const feed: ThemeFeedPluginHelper; declare const git: ThemeGitPluginHelper; declare const mdEnhance: ThemeMdEnhancePluginHelper; declare const photoSwipe: ThemePhotoSwipePluginHelper; declare const pwa: ThemePWAPluginHelper; declare const readingTime: ThemeReadingTimePluginHelper; declare const seo: ThemeSEOPluginHelper; declare const sitemap: ThemeSitemapPluginHelper; declare const themeLocalesData: Record<string, ThemeLocaleData>; /** * @private */ declare const getAlias: (isDebug: boolean) => Record<string, string>; /** * Add tags as customElement * * @param bundlerOptions VuePress Bundler config * @param app VuePress Node App * @param customElements tags recognized as custom element */ declare const checkTag: (bundlerOptions: unknown, app: App) => void; /** * @private */ declare const extendsBundlerOptions: (bundlerOptions: unknown, app: App) => void; /** @private */ declare const getEncryptConfig: (encrypt?: EncryptOptions) => EncryptConfig; /** @private */ declare const checkSocialMediaIcons: (themeData: ThemeData) => Record<string, string>; interface ThemeStatus { enableAutoCatalog: boolean; enableBlog: boolean; enableEncrypt: boolean; enableSlide: boolean; enableReadingTime: boolean; blogType: { key: string; path: string; }[]; hasMultipleLanguages: boolean; supportPageview: boolean; } /** @private */ declare const getStatus: (app: App, themeOptions: ThemeOptions) => ThemeStatus; /** * @private * * Get client-side `themeData` */ declare const getThemeData: (app: App, themeOptions: ThemeOptions, { enableBlog, enableEncrypt }: ThemeStatus) => ThemeData; /** * @private * * Resolve options for @vuepress/plugin-active-header-links */ declare const getActiveHeaderLinksPlugin: (activeHeaderLinks?: b