From aa55e22622c4cf2abc7c4d2c5f9cccf0c6211264 Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Thu, 1 Feb 2024 04:38:58 +0800 Subject: [PATCH] docs: update default-theme docs --- docs/.vuepress/configs/sidebar/en.ts | 2 + docs/.vuepress/configs/sidebar/zh.ts | 3 + docs/themes/default/config.md | 313 +-------------------------- docs/themes/default/locale.md | 196 +++++++++++++++++ docs/themes/default/plugin.md | 127 +++++++++++ docs/zh/themes/default/config.md | 313 +-------------------------- docs/zh/themes/default/locale.md | 196 +++++++++++++++++ docs/zh/themes/default/plugin.md | 127 +++++++++++ 8 files changed, 653 insertions(+), 624 deletions(-) create mode 100644 docs/themes/default/locale.md create mode 100644 docs/themes/default/plugin.md create mode 100644 docs/zh/themes/default/locale.md create mode 100644 docs/zh/themes/default/plugin.md diff --git a/docs/.vuepress/configs/sidebar/en.ts b/docs/.vuepress/configs/sidebar/en.ts index 2feb2574cc..e063e6aa6e 100644 --- a/docs/.vuepress/configs/sidebar/en.ts +++ b/docs/.vuepress/configs/sidebar/en.ts @@ -79,6 +79,8 @@ export const sidebarEn: SidebarConfig = { children: [ '/themes/default/', '/themes/default/config', + '/themes/default/plugin', + '/themes/default/locale', '/themes/default/frontmatter', '/themes/default/components', '/themes/default/markdown', diff --git a/docs/.vuepress/configs/sidebar/zh.ts b/docs/.vuepress/configs/sidebar/zh.ts index 1236e3148e..c1a7e5d952 100644 --- a/docs/.vuepress/configs/sidebar/zh.ts +++ b/docs/.vuepress/configs/sidebar/zh.ts @@ -28,6 +28,7 @@ export const sidebarZh: SidebarConfig = { children: [ '/zh/plugins/feed/guide', '/zh/plugins/feed/config', + '/zh/themes/default/plugin', '/zh/plugins/feed/frontmatter', '/zh/plugins/feed/channel', '/zh/plugins/feed/getter', @@ -79,6 +80,8 @@ export const sidebarZh: SidebarConfig = { children: [ '/zh/themes/default/', '/zh/themes/default/config', + '/zh/themes/default/plugin', + '/zh/themes/default/locale', '/zh/themes/default/frontmatter', '/zh/themes/default/components', '/zh/themes/default/markdown', diff --git a/docs/themes/default/config.md b/docs/themes/default/config.md index f29876878e..63cd48c7ef 100644 --- a/docs/themes/default/config.md +++ b/docs/themes/default/config.md @@ -60,7 +60,7 @@ Config of this section can be used as normal config, and can also be used in the - Also see: - [Default Theme > Config > colorMode](#colormode) - - [Default Theme > Config > toggleColorMode](#togglecolormode) + - [Default Theme > Locale Config > toggleColorMode](./locale.md#togglecolormode) ### home @@ -224,73 +224,6 @@ export default { } ``` -### repoLabel - -- Type: `string` - -- Details: - - Specify the repository label of your project. - - This will be used as the text of the _repository link_, which will be displayed as the last item of the navbar. - - If you don't set this option explicitly, it will be automatically inferred from the [repo](#repo) option. - -### selectLanguageText - -- Type: `string` - -- Details: - - Specify the text of the _select language menu_. - - The _select language menu_ will appear next to the repository button in the navbar when you set multiple [locales](./config.md#locales) in your site config. - -### selectLanguageAriaLabel - -- Type: `string` - -- Details: - - Specify the `aria-label` attribute of the _select language menu_. - - This is mainly for a11y purpose. - -### selectLanguageName - -- Type: `string` - -- Details: - - Specify the name of the language of a locale. - - This option will **only take effect inside** the [locales](#locales) of your theme config. It will be used as the language name of the locale, which will be displayed in the _select language menu_. - -- Example: - -```ts -export default { - locales: { - '/': { - lang: 'en-US', - }, - '/zh/': { - lang: 'zh-CN', - }, - }, - theme: defaultTheme({ - locales: { - '/': { - selectLanguageName: 'English', - }, - '/zh/': { - selectLanguageName: '简体中文', - }, - }, - }), -} -``` - ### sidebar - Type: `false | 'auto' | SidebarConfigArray | SidebarConfigObject` @@ -432,16 +365,6 @@ export default { You can override this global option via [editLink](./frontmatter.md#editlink) frontmatter in your pages. -### editLinkText - -- Type: `string` - -- Default: `'Edit this page'` - -- Details: - - Specify the text of the _edit this page_ link. - ### editLinkPattern - Type: `string` @@ -525,16 +448,6 @@ The generated link will look like `'https://gitlab.com/owner/name/-/edit/master/ You can override this global option via [lastUpdated](./frontmatter.md#lastupdated) frontmatter in your pages. Notice that if you have already set this option to `false`, this feature will be disabled totally and could not be enabled in locales nor page frontmatter. -### lastUpdatedText - -- Type: `string` - -- Default: `'Last Updated'` - -- Details: - - Specify the text of the _last updated timestamp_ label. - ### contributors - Type: `boolean` @@ -546,227 +459,3 @@ The generated link will look like `'https://gitlab.com/owner/name/-/edit/master/ Enable the _contributors list_ or not. You can override this global option via [contributors](./frontmatter.md#contributors) frontmatter in your pages. Notice that if you have already set this option to `false`, this feature will be disabled totally and could not be enabled in locales nor page frontmatter. - -### contributorsText - -- Type: `string` - -- Default: `'Contributors'` - -- Details: - - Specify the text of the _contributors list_ label. - -### tip - -- Type: `string` - -- Default: `'TIP'` - -- Details: - - Specify the default title of the tip [custom containers](./markdown.md#custom-containers). - -### warning - -- Type: `string` - -- Default: `'WARNING'` - -- Details: - - Specify the default title of the warning [custom containers](./markdown.md#custom-containers). - -### danger - -- Type: `string` - -- Default: `'DANGER'` - -- Details: - - Specify the default title of the danger [custom containers](./markdown.md#custom-containers). - -### notFound - -- Type: `string[]` - -- Default: `['Not Found']` - -- Details: - - Specify the messages of the 404 page. - - The message will be randomly picked from the array when users enter the 404 page. - -### backToHome - -- Type: `string` - -- Default: `'Back to home'` - -- Details: - - Specify the text of the _back to home_ link in the 404 page. - -### openInNewWindow - -- Type: `string` - -- Default: `'open in new window'` - -- Details: - - Specify the `sr-only` text of the [ExternalLinkIcon](../../plugins/external-link-icon.md#externallinkicon). - - This is mainly for a11y purpose. - -- Also see: - - [Default Theme > Config Reference > themePlugins.externalLinkIcon](#themeplugins-externallinkicon) - -### toggleColorMode - -- Type: `string` - -- Default: `'toggle color mode'` - -- Details: - - Title text for the color mode toggle button. - - This is mainly for a11y purpose. - -- Also see: - - [Default Theme > Config > colorModeSwitch](#colormodeswitch) - -### toggleSidebar - -- Type: `string` - -- Default: `'toggle sidebar'` - -- Details: - - Title text for sidebar toggle button. - - This is mainly for a11y purpose. - -## Plugins Config - -### themePlugins - -- Details: - - Configure the plugins that used by default theme. - - Default theme is using some plugins by default. You can disable a plugin if you really do not want to use it. Make sure you understand what the plugin is for before disabling it. - -### themePlugins.activeHeaderLinks - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-active-header-links](../../plugins/active-header-links.md) or not. - -### themePlugins.backToTop - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-back-to-top](../../plugins/back-to-top.md) or not. - -### themePlugins.container - -- Type: `Record` - -- Details: - - Enable custom containers that powered by [@vuepress/plugin-container](../../plugins/container.md) or not. - - `ContainerType` type is: - - - `tip` - - `warning` - - `danger` - - `details` - - `codeGroup` - - `codeGroupItem` - -- Also see: - - [Default Theme > Markdown > Custom Containers](./markdown.md#custom-containers) - -### themePlugins.externalLinkIcon - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-external-link-icon](../../plugins/external-link-icon.md) or not. - -### themePlugins.copyCode - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-copy-code](../../plugins/copy-code.md) or not. - -### themePlugins.git - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-git](../../plugins/git.md) or not. - -### themePlugins.mediumZoom - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-medium-zoom](../../plugins/medium-zoom.md) or not. - -### themePlugins.nprogress - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-nprogress](../../plugins/nprogress.md) or not. - -### themePlugins.seo - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-seo](../../plugins/seo/README.md) or not. - -### themePlugins.sitemap - -- Type: `boolean` - -- Default: `true` - -- Details: - - Enable [@vuepress/plugin-sitemap](../../plugins/sitemap/README.md) or not. diff --git a/docs/themes/default/locale.md b/docs/themes/default/locale.md new file mode 100644 index 0000000000..8f596f3464 --- /dev/null +++ b/docs/themes/default/locale.md @@ -0,0 +1,196 @@ +# Locale Config + +These options configure locale-related texts. + +If your site is served in a different language besides English, you should set these options per locale to provide translations. + +## repoLabel + +- Type: `string` + +- Details: + + Specify the repository label of your project. + + This will be used as the text of the _repository link_, which will be displayed as the last item of the navbar. + + If you don't set this option explicitly, it will be automatically inferred from the [repo](./config.md#repo) option. + +## selectLanguageText + +- Type: `string` + +- Details: + + Specify the text of the _select language menu_. + + The _select language menu_ will appear next to the repository button in the navbar when you set multiple [locales](./config.md#locales) in your site config. + +## selectLanguageAriaLabel + +- Type: `string` + +- Details: + + Specify the `aria-label` attribute of the _select language menu_. + + This is mainly for a11y purpose. + +## selectLanguageName + +- Type: `string` + +- Details: + + Specify the name of the language of a locale. + + This option will **only take effect inside** the [locales](./config.md#locales) of your theme config. It will be used as the language name of the locale, which will be displayed in the _select language menu_. + +- Example: + +```ts +export default { + locales: { + '/': { + lang: 'en-US', + }, + '/zh/': { + lang: 'zh-CN', + }, + }, + theme: defaultTheme({ + locales: { + '/': { + selectLanguageName: 'English', + }, + '/zh/': { + selectLanguageName: '简体中文', + }, + }, + }), +} +``` + +## editLinkText + +- Type: `string` + +- Default: `'Edit this page'` + +- Details: + + Specify the text of the _edit this page_ link. + +## lastUpdatedText + +- Type: `string` + +- Default: `'Last Updated'` + +- Details: + + Specify the text of the _last updated timestamp_ label. + +## contributorsText + +- Type: `string` + +- Default: `'Contributors'` + +- Details: + + Specify the text of the _contributors list_ label. + +## tip + +- Type: `string` + +- Default: `'TIP'` + +- Details: + + Specify the default title of the tip [custom containers](./markdown.md#custom-containers). + +## warning + +- Type: `string` + +- Default: `'WARNING'` + +- Details: + + Specify the default title of the warning [custom containers](./markdown.md#custom-containers). + +## danger + +- Type: `string` + +- Default: `'DANGER'` + +- Details: + + Specify the default title of the danger [custom containers](./markdown.md#custom-containers). + +## notFound + +- Type: `string[]` + +- Default: `['Not Found']` + +- Details: + + Specify the messages of the 404 page. + + The message will be randomly picked from the array when users enter the 404 page. + +## backToHome + +- Type: `string` + +- Default: `'Back to home'` + +- Details: + + Specify the text of the _back to home_ link in the 404 page. + +## openInNewWindow + +- Type: `string` + +- Default: `'open in new window'` + +- Details: + + Specify the `sr-only` text of the [ExternalLinkIcon](../../plugins/external-link-icon.md#externallinkicon). + + This is mainly for a11y purpose. + +- Also see: + - [Default Theme > Plugin Config > themePlugins.externalLinkIcon](./plugin.md#themeplugins-externallinkicon) + +## toggleColorMode + +- Type: `string` + +- Default: `'toggle color mode'` + +- Details: + + Title text for the color mode toggle button. + + This is mainly for a11y purpose. + +- Also see: + - [Default Theme > Config > colorModeSwitch](./config.md#colormodeswitch) + +## toggleSidebar + +- Type: `string` + +- Default: `'toggle sidebar'` + +- Details: + + Title text for sidebar toggle button. + + This is mainly for a11y purpose. diff --git a/docs/themes/default/plugin.md b/docs/themes/default/plugin.md new file mode 100644 index 0000000000..a5e4e9dde2 --- /dev/null +++ b/docs/themes/default/plugin.md @@ -0,0 +1,127 @@ +# Plugins Config + +You can configure the plugins that used by default theme with `themePlugins`. + +Default theme is using some plugins by default. You can disable a plugin if you really do not want to use it. Make sure you understand what the plugin is for before disabling it. + +```ts +import { defaultTheme } from '@vuepress/theme-default' + +export default { + theme: defaultTheme({ + themePlugins: { + // customize theme plugins here + }, + }), +} +``` + +## themePlugins.activeHeaderLinks + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-active-header-links](../../plugins/active-header-links.md) or not. + +## themePlugins.backToTop + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-back-to-top](../../plugins/back-to-top.md) or not. + +## themePlugins.container + +- Type: `Record` + +- Details: + + Enable custom containers that powered by [@vuepress/plugin-container](../../plugins/container.md) or not. + + `ContainerType` type is: + + - `tip` + - `warning` + - `danger` + - `details` + - `codeGroup` + - `codeGroupItem` + +- Also see: + - [Default Theme > Markdown > Custom Containers](./markdown.md#custom-containers) + +## themePlugins.externalLinkIcon + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-external-link-icon](../../plugins/external-link-icon.md) or not. + +## themePlugins.copyCode + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-copy-code](../../plugins/copy-code.md) or not. + +## themePlugins.git + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-git](../../plugins/git.md) or not. + +## themePlugins.mediumZoom + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-medium-zoom](../../plugins/medium-zoom.md) or not. + +## themePlugins.nprogress + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-nprogress](../../plugins/nprogress.md) or not. + +## themePlugins.seo + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-seo](../../plugins/seo/README.md) or not. + +## themePlugins.sitemap + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable [@vuepress/plugin-sitemap](../../plugins/sitemap/README.md) or not. diff --git a/docs/zh/themes/default/config.md b/docs/zh/themes/default/config.md index 17c5fc5c3f..833d33735a 100644 --- a/docs/zh/themes/default/config.md +++ b/docs/zh/themes/default/config.md @@ -60,7 +60,7 @@ - 参考: - [默认主题 > 配置 > colorMode](#colormode) - - [默认主题 > 配置 > toggleColorMode](#togglecolormode) + - [默认主题 > 语言配置 > toggleColorMode](./locale.md#togglecolormode) ### home @@ -224,73 +224,6 @@ export default { } ``` -### repoLabel - -- 类型: `string` - -- 详情: - - 项目仓库的标签。 - - 它将被用作 _仓库链接_ 的文字。_仓库链接_ 将会显示为导航栏的最后一个元素。 - - 如果你不明确指定该配置项,它将会根据 [repo](#repo) 配置项自动推断。 - -### selectLanguageText - -- 类型: `string` - -- 详情: - - _选择语言菜单_ 的文字。 - - 如果你在站点配置中设置了多个 [locales](https://v2.vuepress.vuejs.org/zh/config.html#locales) ,那么 _选择语言菜单_ 就会显示在导航栏中仓库按钮的旁边。 - -### selectLanguageAriaLabel - -- 类型: `string` - -- 详情: - - _选择语言菜单_ 的 `aria-label` 属性。 - - 它主要是为了站点的可访问性 (a11y) 。 - -### selectLanguageName - -- 类型: `string` - -- 详情: - - Locale 的语言名称。 - - 该配置项 **仅能在主题配置的 [locales](#locales) 的内部生效** 。它将被用作 locale 的语言名称,展示在 _选择语言菜单_ 内。 - -- 示例: - -```ts -export default { - locales: { - '/': { - lang: 'en-US', - }, - '/zh/': { - lang: 'zh-CN', - }, - }, - theme: defaultTheme({ - locales: { - '/': { - selectLanguageName: 'English', - }, - '/zh/': { - selectLanguageName: '简体中文', - }, - }, - }), -} -``` - ### sidebar - 类型: `false | 'auto' | SidebarConfigArray | SidebarConfigObject` @@ -432,16 +365,6 @@ export default { 你可以通过页面的 [editLink](./frontmatter.md#editlink) frontmatter 来覆盖这个全局配置。 -### editLinkText - -- 类型: `string` - -- 默认值: `'Edit this page'` - -- 详情: - - _编辑此页_ 链接的文字。 - ### editLinkPattern - 类型: `string` @@ -525,16 +448,6 @@ export default { 你可以通过页面的 [lastUpdated](./frontmatter.md#lastupdated) frontmatter 来覆盖这个全局配置。要注意的是,如果你已经将该选项设为了 `false` ,那么这个功能会被完全禁用,并且无法在 locales 或页面 frontmatter 中启用。 -### lastUpdatedText - -- 类型: `string` - -- 默认值: `'Last Updated'` - -- 详情: - - _最近更新时间戳_ 标签的文字。 - ### contributors - 类型: `boolean` @@ -546,227 +459,3 @@ export default { 是否启用 _贡献者列表_ 。 你可以通过页面的 [contributors](./frontmatter.md#contributors) frontmatter 来覆盖这个全局配置。要注意的是,如果你已经将该选项设为了 `false` ,那么这个功能会被完全禁用,并且无法在 locales 或页面 frontmatter 中启用。 - -### contributorsText - -- 类型: `string` - -- 默认值: `'Contributors'` - -- 详情: - - _贡献者列表_ 标签的文字。 - -### tip - -- 类型: `string` - -- 默认值: `'TIP'` - -- 详情: - - Tip [自定义容器](./markdown.md#自定义容器) 的默认标题。 - -### warning - -- 类型: `string` - -- 默认值: `'WARNING'` - -- 详情: - - Warning [自定义容器](./markdown.md#自定义容器) 的默认标题。 - -### danger - -- 类型: `string` - -- 默认值: `'DANGER'` - -- 详情: - - Danger [自定义容器](./markdown.md#自定义容器) 的默认标题。 - -### notFound - -- 类型: `string[]` - -- 默认值: `['Not Found']` - -- 详情: - - 404 页面的提示信息。 - - 当用户进入 404 页面时,会从数组中随机选取一条信息进行展示。 - -### backToHome - -- 类型: `string` - -- 默认值: `'Back to home'` - -- 详情: - - 404 页面中 _返回首页_ 链接的文字。 - -### openInNewWindow - -- 类型: `string` - -- 默认值: `'open in new window'` - -- 详情: - - [ExternalLinkIcon](../../plugins/external-link-icon.md#externallinkicon). 链接内的 `sr-only` 文字。 - - 它主要是为了站点的可访问性 (a11y) 。 - -- 参考: - - [默认主题 > 配置 > themePlugins.externalLinkIcon](#themeplugins-externallinkicon) - -### toggleColorMode - -- 类型: `string` - -- 默认值: `'toggle color mode'` - -- 详情: - - 切换颜色模式按钮的标题文字。 - - 它主要是为了站点的可访问性 (a11y) 。 - -- 参考: - - [默认主题 > 配置 > colorModeSwitch](#colormodeswitch) - -### toggleSidebar - -- 类型: `string` - -- 默认值: `'toggle sidebar'` - -- 详情: - - 切换侧边栏按钮的标题文字。 - - 它主要是为了站点的可访问性 (a11y) 。 - -## 插件配置 - -### themePlugins - -- 详情: - - 设置默认主题使用的插件。 - - 默认主题使用了一些插件,如果你确实不需要该插件,你可以选择禁用它。在禁用插件之前,请确保你已了解它的用途。 - -### themePlugins.activeHeaderLinks - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-active-header-links](../../plugins/active-header-links.md) 。 - -#### themePlugins.backToTop - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-back-to-top](../../plugins/back-to-top.md) 。 - -### themePlugins.container - -- 类型: `Record` - -- 详情: - - 是否启用由 [@vuepress/plugin-container](../../plugins/container.md) 支持的自定义容器。 - - `ContainerType` 类型为: - - - `tip` - - `warning` - - `danger` - - `details` - - `codeGroup` - - `codeGroupItem` - -- 参考: - - [默认主题 > Markdown > 自定义容器](./markdown.md#自定义容器) - -### themePlugins.copyCode - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-copy-code](../../plugins/copy-code.md) 。 - -### themePlugins.externalLinkIcon - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-external-link-icon](../../plugins/external-link-icon.md) 。 - -### themePlugins.git - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-git](../../plugins/git.md) 。 - -### themePlugins.mediumZoom - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-medium-zoom](../../plugins/medium-zoom.md) 。 - -### themePlugins.nprogress - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-nprogress](../../plugins/nprogress.md) 。 - -### themePlugins.seo - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-seo](../../plugins/seo/README.md) 。 - -### themePlugins.sitemap - -- 类型: `boolean` - -- 默认值: `true` - -- 详情: - - 是否启用 [@vuepress/plugin-sitemap](../../plugins/sitemap/README.md) 。 diff --git a/docs/zh/themes/default/locale.md b/docs/zh/themes/default/locale.md new file mode 100644 index 0000000000..07e2796554 --- /dev/null +++ b/docs/zh/themes/default/locale.md @@ -0,0 +1,196 @@ +# 语言配置 + +这些选项用于配置与语言相关的文本。 + +如果你的站点是以英语以外的其他语言提供服务的,你应该为每个语言设置这些选项来提供翻译。 + +## repoLabel + +- 类型: `string` + +- 详情: + + 项目仓库的标签。 + + 它将被用作 _仓库链接_ 的文字。_仓库链接_ 将会显示为导航栏的最后一个元素。 + + 如果你不明确指定该配置项,它将会根据 [repo](./config.md#repo) 配置项自动推断。 + +## selectLanguageText + +- 类型: `string` + +- 详情: + + _选择语言菜单_ 的文字。 + + 如果你在站点配置中设置了多个 [locales](https://v2.vuepress.vuejs.org/zh/config.html#locales) ,那么 _选择语言菜单_ 就会显示在导航栏中仓库按钮的旁边。 + +## selectLanguageAriaLabel + +- 类型: `string` + +- 详情: + + _选择语言菜单_ 的 `aria-label` 属性。 + + 它主要是为了站点的可访问性 (a11y) 。 + +## selectLanguageName + +- 类型: `string` + +- 详情: + + Locale 的语言名称。 + + 该配置项 **仅能在主题配置的 [locales](./config.md#locales) 的内部生效** 。它将被用作 locale 的语言名称,展示在 _选择语言菜单_ 内。 + +- 示例: + +```ts +export default { + locales: { + '/': { + lang: 'en-US', + }, + '/zh/': { + lang: 'zh-CN', + }, + }, + theme: defaultTheme({ + locales: { + '/': { + selectLanguageName: 'English', + }, + '/zh/': { + selectLanguageName: '简体中文', + }, + }, + }), +} +``` + +## editLinkText + +- 类型: `string` + +- 默认值: `'Edit this page'` + +- 详情: + + _编辑此页_ 链接的文字。 + +## lastUpdatedText + +- 类型: `string` + +- 默认值: `'Last Updated'` + +- 详情: + + _最近更新时间戳_ 标签的文字。 + +## contributorsText + +- 类型: `string` + +- 默认值: `'Contributors'` + +- 详情: + + _贡献者列表_ 标签的文字。 + +## tip + +- 类型: `string` + +- 默认值: `'TIP'` + +- 详情: + + Tip [自定义容器](./markdown.md#自定义容器) 的默认标题。 + +## warning + +- 类型: `string` + +- 默认值: `'WARNING'` + +- 详情: + + Warning [自定义容器](./markdown.md#自定义容器) 的默认标题。 + +## danger + +- 类型: `string` + +- 默认值: `'DANGER'` + +- 详情: + + Danger [自定义容器](./markdown.md#自定义容器) 的默认标题。 + +## notFound + +- 类型: `string[]` + +- 默认值: `['Not Found']` + +- 详情: + + 404 页面的提示信息。 + + 当用户进入 404 页面时,会从数组中随机选取一条信息进行展示。 + +## backToHome + +- 类型: `string` + +- 默认值: `'Back to home'` + +- 详情: + + 404 页面中 _返回首页_ 链接的文字。 + +## openInNewWindow + +- 类型: `string` + +- 默认值: `'open in new window'` + +- 详情: + + [ExternalLinkIcon](../../plugins/external-link-icon.md#externallinkicon). 链接内的 `sr-only` 文字。 + + 它主要是为了站点的可访问性 (a11y) 。 + +- 参考: + - [默认主题 > 插件配置 > themePlugins.externalLinkIcon](./plugin.md#themeplugins-externallinkicon) + +## toggleColorMode + +- 类型: `string` + +- 默认值: `'toggle color mode'` + +- 详情: + + 切换颜色模式按钮的标题文字。 + + 它主要是为了站点的可访问性 (a11y) 。 + +- 参考: + - [默认主题 > 配置 > colorModeSwitch](./config.md#colormodeswitch) + +## toggleSidebar + +- 类型: `string` + +- 默认值: `'toggle sidebar'` + +- 详情: + + 切换侧边栏按钮的标题文字。 + + 它主要是为了站点的可访问性 (a11y) 。 diff --git a/docs/zh/themes/default/plugin.md b/docs/zh/themes/default/plugin.md new file mode 100644 index 0000000000..36ea1a970b --- /dev/null +++ b/docs/zh/themes/default/plugin.md @@ -0,0 +1,127 @@ +# 插件配置 + +你可以通过 `themePlugins` 设置默认主题使用的插件。 + +默认主题使用了一些插件,如果你确实不需要该插件,你可以选择禁用它。在禁用插件之前,请确保你已了解它的用途。 + +```ts +import { defaultTheme } from '@vuepress/theme-default' + +export default { + theme: defaultTheme({ + themePlugins: { + // 在这里自定义主题插件 + }, + }), +} +``` + +## themePlugins.activeHeaderLinks + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-active-header-links](../../plugins/active-header-links.md) 。 + +### themePlugins.backToTop + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-back-to-top](../../plugins/back-to-top.md) 。 + +## themePlugins.container + +- 类型: `Record` + +- 详情: + + 是否启用由 [@vuepress/plugin-container](../../plugins/container.md) 支持的自定义容器。 + + `ContainerType` 类型为: + + - `tip` + - `warning` + - `danger` + - `details` + - `codeGroup` + - `codeGroupItem` + +- 参考: + - [默认主题 > Markdown > 自定义容器](./markdown.md#自定义容器) + +## themePlugins.copyCode + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-copy-code](../../plugins/copy-code.md) 。 + +## themePlugins.externalLinkIcon + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-external-link-icon](../../plugins/external-link-icon.md) 。 + +## themePlugins.git + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-git](../../plugins/git.md) 。 + +## themePlugins.mediumZoom + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-medium-zoom](../../plugins/medium-zoom.md) 。 + +## themePlugins.nprogress + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-nprogress](../../plugins/nprogress.md) 。 + +## themePlugins.seo + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-seo](../../plugins/seo/README.md) 。 + +## themePlugins.sitemap + +- 类型: `boolean` + +- 默认值: `true` + +- 详情: + + 是否启用 [@vuepress/plugin-sitemap](../../plugins/sitemap/README.md) 。