From fcf847547a38693c21737ca7ef5f2af66bcf25d8 Mon Sep 17 00:00:00 2001 From: "Mr.Hope" Date: Tue, 6 Feb 2024 11:48:25 +0800 Subject: [PATCH] feat: update docs --- docs/.vuepress/config.ts | 52 --------- docs/.vuepress/configs/navbar/en.ts | 7 ++ docs/.vuepress/configs/navbar/zh.ts | 7 ++ docs/.vuepress/configs/sidebar/en.ts | 36 +++--- docs/.vuepress/configs/sidebar/zh.ts | 31 +++-- docs/.vuepress/styles/index.scss | 6 +- docs/.vuepress/theme.ts | 12 +- docs/README.md | 3 + docs/guide/troubleshooting.md | 4 + docs/reference/plugin/container.md | 165 --------------------------- docs/zh/README.md | 3 + docs/zh/guide/troubleshooting.md | 4 + 12 files changed, 69 insertions(+), 261 deletions(-) delete mode 100644 docs/reference/plugin/container.md diff --git a/docs/.vuepress/config.ts b/docs/.vuepress/config.ts index 4bf273ce..a5c23b3d 100644 --- a/docs/.vuepress/config.ts +++ b/docs/.vuepress/config.ts @@ -2,7 +2,6 @@ import { createRequire } from 'node:module' import process from 'node:process' import { viteBundler } from '@vuepress/bundler-vite' import { webpackBundler } from '@vuepress/bundler-webpack' -import { docsearchPlugin } from '@vuepress/plugin-docsearch' import { registerComponentsPlugin } from '@vuepress/plugin-register-components' import { defineUserConfig } from 'vuepress' import { getDirname, path } from 'vuepress/utils' @@ -61,57 +60,6 @@ export default defineUserConfig({ // use plugins plugins: [ - docsearchPlugin({ - appId: '34YFD9IUQ2', - apiKey: '9a9058b8655746634e01071411c366b8', - indexName: 'vuepress', - searchParameters: { - facetFilters: ['tags:v2'], - }, - locales: { - '/zh/': { - placeholder: '搜索文档', - translations: { - button: { - buttonText: '搜索文档', - buttonAriaLabel: '搜索文档', - }, - modal: { - searchBox: { - resetButtonTitle: '清除查询条件', - resetButtonAriaLabel: '清除查询条件', - cancelButtonText: '取消', - cancelButtonAriaLabel: '取消', - }, - startScreen: { - recentSearchesTitle: '搜索历史', - noRecentSearchesText: '没有搜索历史', - saveRecentSearchButtonTitle: '保存至搜索历史', - removeRecentSearchButtonTitle: '从搜索历史中移除', - favoriteSearchesTitle: '收藏', - removeFavoriteSearchButtonTitle: '从收藏中移除', - }, - errorScreen: { - titleText: '无法获取结果', - helpText: '你可能需要检查你的网络连接', - }, - footer: { - selectText: '选择', - navigateText: '切换', - closeText: '关闭', - searchByText: '搜索提供者', - }, - noResultsScreen: { - noResultsText: '无法找到相关结果', - suggestedQueryText: '你可以尝试查询', - reportMissingResultsText: '你认为该查询应该有结果?', - reportMissingResultsLinkText: '点击反馈', - }, - }, - }, - }, - }, - }), registerComponentsPlugin({ componentsDir: path.resolve(__dirname, './components'), }), diff --git a/docs/.vuepress/configs/navbar/en.ts b/docs/.vuepress/configs/navbar/en.ts index 021a7f35..c301a33d 100644 --- a/docs/.vuepress/configs/navbar/en.ts +++ b/docs/.vuepress/configs/navbar/en.ts @@ -53,10 +53,12 @@ export const enNavbar = navbar([ children: [ { text: 'Default Theme', + icon: 'fa6-solid:palette', link: 'https://ecosystem.vuejs.press/themes/default/', }, { text: 'Plugins', + icon: 'fa6-solid:puzzle-piece', link: 'https://ecosystem.vuejs.press/plugins/', }, ], @@ -77,6 +79,7 @@ export const enNavbar = navbar([ 'theme', { text: 'Cookbook', + icon: 'fa6-solid:signs-post', link: 'cookbook/', }, ], @@ -86,14 +89,17 @@ export const enNavbar = navbar([ children: [ { text: 'Ecosystem', + icon: 'fa6-solid:leaf', link: 'https://ecosystem.vuejs.press/', }, { text: 'MarketPlace', + icon: 'fa6-solid:cart-shopping', link: 'https://marketplace.vuejs.press', }, { text: 'Contributing Guide', + icon: 'fa6-solid:signs-post', link: 'https://github.com/vuepress/core/blob/main/CONTRIBUTING.md', }, ], @@ -106,6 +112,7 @@ export const enNavbar = navbar([ children: [ { text: 'Changelog', + icon: 'fa6-solid:clock', link: 'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md', }, { diff --git a/docs/.vuepress/configs/navbar/zh.ts b/docs/.vuepress/configs/navbar/zh.ts index 78d9dded..db88d67d 100644 --- a/docs/.vuepress/configs/navbar/zh.ts +++ b/docs/.vuepress/configs/navbar/zh.ts @@ -49,10 +49,12 @@ export const zhNavbar = navbar([ children: [ { text: '默认主题', + icon: 'fa6-solid:palette', link: 'https://ecosystem.vuejs.press/zh/themes/default/', }, { text: '插件', + icon: 'fa6-solid:puzzle-piece', link: 'https://ecosystem.vuejs.press/zh/plugins/', }, ], @@ -72,6 +74,7 @@ export const zhNavbar = navbar([ 'theme', { text: 'Cookbook', + icon: 'fa6-solid:signs-post', link: 'cookbook/', }, ], @@ -81,14 +84,17 @@ export const zhNavbar = navbar([ children: [ { text: '生态系统', + icon: 'fa6-solid:leaf', link: 'https://ecosystem.vuejs.press/zh/', }, { text: '市场', + icon: 'fa6-solid:cart-shopping', link: 'https://marketplace.vuejs.press/zh/', }, { text: '贡献指南', + icon: 'fa6-solid:signs-post', link: 'https://github.com/vuepress/core/blob/main/CONTRIBUTING_zh.md', }, ], @@ -101,6 +107,7 @@ export const zhNavbar = navbar([ children: [ { text: '更新日志', + icon: 'fa6-solid:clock', link: 'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md', }, { diff --git a/docs/.vuepress/configs/sidebar/en.ts b/docs/.vuepress/configs/sidebar/en.ts index 803f152f..e744b2b7 100644 --- a/docs/.vuepress/configs/sidebar/en.ts +++ b/docs/.vuepress/configs/sidebar/en.ts @@ -2,24 +2,19 @@ import { sidebar } from 'vuepress-theme-hope' export const enSidebar = sidebar({ '/guide/': [ - { - text: 'Guide', - children: [ - 'introduction', - 'getting-started', - 'configuration', - 'page', - 'markdown', - 'assets', - 'i18n', - 'deployment', - 'theme', - 'plugin', - 'bundler', - 'migration', - 'troubleshooting', - ], - }, + 'introduction', + 'getting-started', + 'configuration', + 'page', + 'markdown', + 'assets', + 'i18n', + 'deployment', + 'theme', + 'plugin', + 'bundler', + 'migration', + 'troubleshooting', ], '/advanced/': [ { @@ -66,10 +61,11 @@ export const enSidebar = sidebar({ }, { text: 'Ecosystem', + icon: 'fa6-solid:leaf', children: [ { text: 'Default Theme', - icon: 'fa6-solid:leaf', + icon: 'fa6-solid:palette', link: 'https://ecosystem.vuejs.press/themes/default/', }, { @@ -78,7 +74,7 @@ export const enSidebar = sidebar({ link: 'https://ecosystem.vuejs.press/plugins/', }, { - text: 'VuePress MarketPlace', + text: 'MarketPlace', icon: 'fa6-solid:cart-shopping', link: 'https://marketplace.vuejs.press', }, diff --git a/docs/.vuepress/configs/sidebar/zh.ts b/docs/.vuepress/configs/sidebar/zh.ts index 30247bee..f7a31ccc 100644 --- a/docs/.vuepress/configs/sidebar/zh.ts +++ b/docs/.vuepress/configs/sidebar/zh.ts @@ -2,24 +2,19 @@ import { sidebar } from 'vuepress-theme-hope' export const zhSidebar = sidebar({ '/zh/guide/': [ - { - text: '指南', - children: [ - 'introduction', - 'getting-started', - 'configuration', - 'page', - 'markdown', - 'assets', - 'i18n', - 'deployment', - 'theme', - 'plugin', - 'bundler', - 'migration', - 'troubleshooting', - ], - }, + 'introduction', + 'getting-started', + 'configuration', + 'page', + 'markdown', + 'assets', + 'i18n', + 'deployment', + 'theme', + 'plugin', + 'bundler', + 'migration', + 'troubleshooting', ], '/zh/advanced/': [ { diff --git a/docs/.vuepress/styles/index.scss b/docs/.vuepress/styles/index.scss index 90dc235e..4b75311f 100644 --- a/docs/.vuepress/styles/index.scss +++ b/docs/.vuepress/styles/index.scss @@ -2,8 +2,6 @@ scroll-behavior: smooth; } -@media (min-width: 751px) { - #docsearch-container:lang(zh-CN) { - min-width: 184.66px; - } +.icon { + font-size: 0.9em !important; } diff --git a/docs/.vuepress/theme.ts b/docs/.vuepress/theme.ts index 8bcb07fe..d4a22339 100644 --- a/docs/.vuepress/theme.ts +++ b/docs/.vuepress/theme.ts @@ -21,7 +21,7 @@ export default hopeTheme({ footer: 'Theme by VuePress Theme Hope', - copyright: 'MIT Licensed | Copyright © 2018-present Evan You', + copyright: 'MIT Licensed | Copyright © 2018-present VuePress Community', displayFooter: true, @@ -43,7 +43,7 @@ export default hopeTheme({ footer: '主题使用 VuePress Theme Hope', - copyright: 'MIT 协议 | 版权所有 © 2018-至今 尤雨溪', + copyright: 'MIT 协议 | 版权所有 © 2018-至今 VuePress 社区', displayFooter: true, @@ -55,6 +55,14 @@ export default hopeTheme({ }, plugins: { + docsearch: { + appId: '34YFD9IUQ2', + apiKey: '9a9058b8655746634e01071411c366b8', + indexName: 'vuepress', + searchParameters: { + facetFilters: ['tags:v2'], + }, + }, mdEnhance: { codetabs: true, }, diff --git a/docs/README.md b/docs/README.md index 6fefcc20..baccdfbe 100644 --- a/docs/README.md +++ b/docs/README.md @@ -5,12 +5,15 @@ icon: fa6-solid:house heroImage: /images/hero.png actions: - text: Get Started + icon: fa6-solid:lightbulb link: /guide/getting-started.html type: primary - text: Introduction + icon: fa6-solid:circle-info link: /guide/introduction.html type: secondary - text: Marketplace + icon: fa6-solid:cart-shopping link: https://marketplace.vuejs.press/ type: secondary features: diff --git a/docs/guide/troubleshooting.md b/docs/guide/troubleshooting.md index 160afa12..71072b72 100644 --- a/docs/guide/troubleshooting.md +++ b/docs/guide/troubleshooting.md @@ -1,3 +1,7 @@ +--- +icon: fa6-solid:circle-question +--- + # Troubleshooting ## The bundler / theme option is missing? diff --git a/docs/reference/plugin/container.md b/docs/reference/plugin/container.md deleted file mode 100644 index 5f245e41..00000000 --- a/docs/reference/plugin/container.md +++ /dev/null @@ -1,165 +0,0 @@ -# container - - - -Register markdown custom containers in your VuePress site. - -This plugin simplifies the use of [markdown-it-container](https://github.com/markdown-it/markdown-it-container), but also retains its original capabilities. - -The [Custom Containers](../default-theme/markdown.md#custom-containers) of default theme is powered by this plugin. - -## Usage - -```bash -npm i -D @vuepress/plugin-container@next -``` - -```ts -import { containerPlugin } from '@vuepress/plugin-container' - -export default { - plugins: [ - containerPlugin({ - // options - }), - ], -} -``` - -## Container Syntax - -```md -::: [info] -[content] -::: -``` - -- The `type` is required and should be specified via [type](#type) option. -- The `info` is optional, and the default value can be specified via `defaultInfo` in [locales](#locales) option. -- The `content` can be any valid markdown content. - -::: tip -This plugin can be used multiple times to support different types of containers. -::: - -## Options - -### type - -- Type: `string` - -- Details: - - The type of the container. - - It will be used as the `name` param of [markdown-it-container](https://github.com/markdown-it/markdown-it-container#api). - -### locales - -- Type: `Record` - -- Details: - - The default `info` of the container in different locales. - - If this option is not specified, the default `info` will fallback to the uppercase of the [type](#type) option. - -- Example: - - ```ts - export default { - plugins: [ - containerPlugin({ - type: 'tip', - locales: { - '/': { - defaultInfo: 'TIP', - }, - '/zh/': { - defaultInfo: '提示', - }, - }, - }), - ], - } - ``` - -- Also see: - - [Guide > I18n](../../guide/i18n.md) - -### before - -- Type: `(info: string) => string` - -- Default: - - -```ts -(info: string): string => - `
${info ? `

${info}

` : ''}\n` -``` - - -- Details: - - A function to render the starting tag of the container. - - The first param is the `info` part of [container syntax](#container-syntax). - - This option will not take effect if you don't specify the [after](#after) option. - -### after - -- Type: `(info: string) => string` - -- Default: - - -```ts -(): string => '
\n' -``` - - -- Details: - - A function to render the ending tag of the container. - - The first param is the `info` part of [container syntax](#container-syntax). - - This option will not take effect if you don't specify the [before](#before) option. - -### render - -- Type: - - ```ts - type MarkdownItContainerRenderFunction = ( - tokens: Token[], - index: number, - options: any, - env: MarkdownEnv, - self: Renderer, - ) => string - ``` - -- Details: - - The `render` option of [markdown-it-container](https://github.com/markdown-it/markdown-it-container#api). - - This plugin uses a default `render` function. If you specify this option, the default `render` function will be replaced, and the [locales](#locales), [before](#before) and [after](#after) options will be ignored. - -### validate - -- Type: `(params: string) => boolean` - -- Details: - - The `validate` option of [markdown-it-container](https://github.com/markdown-it/markdown-it-container#api). - -### marker - -- Type: `string` - -- Details: - - The `marker` option of [markdown-it-container](https://github.com/markdown-it/markdown-it-container#api). diff --git a/docs/zh/README.md b/docs/zh/README.md index 375c12c8..de01220a 100644 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -5,12 +5,15 @@ title: 首页 heroImage: /images/hero.png actions: - text: 快速上手 + icon: fa6-solid:lightbulb link: /zh/guide/getting-started.html type: primary - text: 项目简介 + icon: fa6-solid:circle-info link: /zh/guide/introduction.html type: secondary - text: 市场 + icon: fa6-solid:cart-shopping link: https://marketplace.vuejs.press/zh/ type: secondary features: diff --git a/docs/zh/guide/troubleshooting.md b/docs/zh/guide/troubleshooting.md index 739fb30e..b4192e0f 100644 --- a/docs/zh/guide/troubleshooting.md +++ b/docs/zh/guide/troubleshooting.md @@ -1,3 +1,7 @@ +--- +icon: fa6-solid:circle-question +--- + # 常见问题 ## 缺少 bundler / theme 配置?