Skip to content

Commit

Permalink
docs: tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 4, 2023
1 parent 27fa9a2 commit fd836b1
Show file tree
Hide file tree
Showing 32 changed files with 94 additions and 86 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ VuePress documentation repository.

## Deployments

- Release deployment: https://v2.vuepress.vuejs.org
- Developer deployment: https://vuepress.github.io
- Release deployment: <https://v2.vuepress.vuejs.org>
- Developer deployment: <https://vuepress.github.io>

## License

Expand Down
2 changes: 1 addition & 1 deletion docs/advanced/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,4 @@ The above figure shows the core process of VuePress Node App and the hooks of [P
- In the **dev / build** stage:
- Bundler will be resolved:
- [extendsBundlerOptions](../reference/plugin-api.md#extendsbundleroptions) hook will be processed to create bundler configuration.
- [alias](../reference/plugin-api.md#alias) hook and [define](../reference/plugin-api.md#define) hook would be used in bundler configuration, so they will be processed here.
- [alias](../reference/plugin-api.md#alias) hook and [define](../reference/plugin-api.md#define) hook would be used in bundler configuration, so they will be processed here.
15 changes: 8 additions & 7 deletions docs/advanced/cookbook/markdown-and-vue-sfc.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,14 @@ _Current count is: {{ count }}_
<script setup>
import { h, ref } from 'vue'

const RedDiv = (_, ctx) => h(
'div',
{
class: 'red-div',
},
ctx.slots.default()
)
const RedDiv = (_, ctx) =>
h(
'div',
{
class: 'red-div',
},
ctx.slots.default(),
)
const msg = 'Vue in Markdown'
const count = ref(0)
</script>
Expand Down
6 changes: 3 additions & 3 deletions docs/advanced/cookbook/usage-of-client-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const pluginOrTheme = {
}
```

Inside the client config file, `@vuepress/client` package provides a helper function [defineClientConfig](../../reference/client-api.md#defineclientconfig) to help you define the client config:
Inside the client config file, `@vuepress/client` package provides a helper function [defineClientConfig](../../reference/client-api.md#defineclientconfig) to help you define the client config:

```ts
import { defineClientConfig } from '@vuepress/client'
Expand Down Expand Up @@ -119,7 +119,7 @@ export default defineClientConfig({
// provide a value that can be injected by layouts, pages and other components
const count = ref(0)
provide('count', count)
}
},
})
```

Expand All @@ -139,7 +139,7 @@ export default defineClientConfig({
// use DOM API after mounted
document.querySelector('#app')
})
}
},
})
```

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'
export default {
plugins: [
googleAnalyticsPlugin({
id: 'G-XXXXXXXXXX'
id: 'G-XXXXXXXXXX',
}),
],
}
Expand Down
5 changes: 4 additions & 1 deletion docs/reference/default-theme/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ export default {
{
text: 'Bundlers Reference',
collapsible: true,
children: ['/reference/bundler/vite.md', '/reference/bundler/webpack.md'],
children: [
'/reference/bundler/vite.md',
'/reference/bundler/webpack.md',
],
},
],
},
Expand Down
15 changes: 8 additions & 7 deletions docs/reference/default-theme/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
The `type` is required, and the `title` and `content` are optional.

Supported `type` :
- `tip`
- `warning`
- `danger`
- `details`
- Alias of [CodeGroup](./components.md#codegroup) and [CodeGroupItem](./components.md#codegroupitem):
- `code-group`
- `code-group-item`

- `tip`
- `warning`
- `danger`
- `details`
- Alias of [CodeGroup](./components.md#codegroup) and [CodeGroupItem](./components.md#codegroupitem):
- `code-group`
- `code-group-item`

- Example 1 (default title):

Expand Down
6 changes: 5 additions & 1 deletion docs/reference/node-api.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
icon: fa6-brands:node-js
---

# Node API

<NpmBadge package="@vuepress/core" />
Expand Down Expand Up @@ -357,7 +361,7 @@ export default {
Hello, world.
`,
})
}),
)
},
}
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/plugin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ const __dirname = getDirname(import.meta.url)
export default {
clientConfigFile: path.resolve(
__dirname,
'./path/to/clientConfig.js'
'./path/to/clientConfig.js',
),
}
```
Expand Down Expand Up @@ -263,7 +263,7 @@ export default {
Page options extension.

This hook accepts a function that will receive the options of `createPage`.

This hook can be used for modifying page options

- Example:
Expand Down
6 changes: 4 additions & 2 deletions docs/reference/plugin/container.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ export default {

```ts
(info: string): string =>
`<div class="custom-container ${type}">${info ? `<p class="custom-container-title">${info}</p>` : ''}\n`
`<div class="custom-container ${type}">${
info ? `<p class="custom-container-title">${info}</p>` : ''
}\n`
```

- Details:
Expand Down Expand Up @@ -134,7 +136,7 @@ type MarkdownItContainerRenderFunction = (
index: number,
options: any,
env: MarkdownEnv,
self: Renderer
self: Renderer,
) => string
```
Expand Down
7 changes: 2 additions & 5 deletions docs/reference/plugin/pwa.md
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ But if you omit `skipWaiting` or set it to `false`, you have to activate the new
- Details:

Returns the event emitter of this plugin.

You can add listener function to events that provided by [register-service-worker](https://github.com/yyx990803/register-service-worker).

- Example:
Expand Down Expand Up @@ -158,10 +158,7 @@ export default {
- Example:

```ts
import {
usePwaEvent,
useSkipWaiting,
} from '@vuepress/plugin-pwa/client'
import { usePwaEvent, useSkipWaiting } from '@vuepress/plugin-pwa/client'

export default {
setup() {
Expand Down
6 changes: 3 additions & 3 deletions docs/reference/plugin/register-components.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ import { defineAsyncComponent } from 'vue'

app.component(
'FooBar',
defineAsyncComponent(() => import('/path/to/components/FooBar.vue'))
defineAsyncComponent(() => import('/path/to/components/FooBar.vue')),
)

app.component(
'Baz',
defineAsyncComponent(() => import('/path/to/components/Baz.vue'))
defineAsyncComponent(() => import('/path/to/components/Baz.vue')),
)
```

Expand All @@ -129,7 +129,7 @@ app.component(
- Details:

A function to get component name from the filename.

It will only take effect on the files in the [componentsDir](#componentsdir) which are matched with the [componentsPatterns](#componentspatterns).

Notice that the `filename` is a filepath relative to [componentsDir](#componentsdir).
4 changes: 2 additions & 2 deletions docs/reference/plugin/shiki.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export default {

Theme of shiki.

This option will be forwarded to `getHighlighter()` method of shiki.
This option will be forwarded to `getHighlighter()` method of shiki.

- Also see:
- [shiki > themes](https://github.com/shikijs/shiki/blob/master/docs/themes.md)
Expand All @@ -55,7 +55,7 @@ export default {

Languages of shiki.

This option will be forwarded to `getHighlighter()` method of shiki.
This option will be forwarded to `getHighlighter()` method of shiki.

If no languages are provided, shiki will load all available languages automatically.

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ features:
details: 灵活的插件API,使得插件可以为你的站点提供许多即插即用的功能。
- title: 打包工具
details: 默认的打包工具是 Vite ,也同样支持 Webpack 。选一个你喜欢的来使用吧!
footer: MIT Licensed | Copyright © 2018-present VuePress Community
footer: MIT 协议 | 版权所有 © 2018-至今 VuePress 社区
---
15 changes: 8 additions & 7 deletions docs/zh/advanced/cookbook/markdown-and-vue-sfc.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ _当前计数为: {{ count }}_
<script setup>
import { h, ref } from 'vue'
const RedDiv = (_, ctx) => h(
'div',
{
class: 'red-div',
},
ctx.slots.default()
)
const RedDiv = (_, ctx) =>
h(
'div',
{
class: 'red-div',
},
ctx.slots.default(),
)
const msg = 'Markdown 中的 Vue'
const count = ref(0)
</script>
Expand Down
1 change: 0 additions & 1 deletion docs/zh/advanced/cookbook/passing-data-to-client-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export default (options) => ({

然后,在客户端代码中直接使用它们:


```ts
const foo = __FOO__
const obj = __OBJ__
Expand Down
4 changes: 2 additions & 2 deletions docs/zh/advanced/cookbook/usage-of-client-config.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default defineClientConfig({
// 供给一个值,可以被布局、页面和其他组件注入
const count = ref(0)
provide('count', count)
}
},
})
```

Expand All @@ -139,7 +139,7 @@ export default defineClientConfig({
// 在 mounted 之后使用 DOM API
document.querySelector('#app')
})
}
},
})
```

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ VuePress 诞生的初衷是为了支持 Vue.js 及其子项目的文档需求,

在开发过程中,我们启动一个常规的开发服务器 (dev-server) ,并将 VuePress 站点作为一个常规的 SPA。如果你以前使用过 Vue 的话,你在使用时会感受到非常熟悉的开发体验。

在构建过程中,我们会为 VuePress 站点创建一个服务端渲染 (SSR) 的版本,然后通过虚拟访问每一条路径来渲染对应的 HTML 。这种做法的灵感来源于 [Nuxt](https://nuxtjs.org/)`nuxt generate` 命令,以及其他的一些项目,比如 [Gatsby](https://www.gatsbyjs.org/)
在构建过程中,我们会为 VuePress 站点创建一个服务端渲染 (SSR) 的版本,然后通过虚拟访问每一条路径来渲染对应的 HTML 。这种做法的灵感来源于 [Nuxt](https://nuxtjs.org/)`nuxt generate` 命令,以及其他的一些项目,比如 [Gatsby](https://www.gatsbyjs.org/)

## 为什么不是 ...?

Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/bundler.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# 打包工具

VuePress 一直以来都在使用 [Webpack](https://webpack.js.org/) 作为打包工具来进行网站的开发和构建。从 VuePress v2 开始,我们还支持使用其他的打包工具,并且现在使用 [Vite](https://vitejs.dev/) 作为默认的打包工具。当然,你仍然可以选择使用 Webpack 。
VuePress 一直以来都在使用 [Webpack](https://webpack.js.org/) 作为打包工具来进行网站的开发和构建。从 VuePress v2 开始,我们还支持使用其他的打包工具,并且现在使用 [Vite](https://vitejs.dev/) 作为默认的打包工具。当然,你仍然可以选择使用 Webpack 。

## 选择一个打包工具

Expand Down
10 changes: 5 additions & 5 deletions docs/zh/guide/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@

1. 设置正确的 [base](../reference/config.md#base) 选项。

如果你准备发布到 `https://<USERNAME>.github.io/` ,你可以省略这一步,因为 `base` 默认就是 `"/"`
如果你准备发布到 `https://<USERNAME>.github.io/` ,你可以省略这一步,因为 `base` 默认就是 `"/"`

如果你准备发布到 `https://<USERNAME>.github.io/<REPO>/` ,也就是说你的仓库地址是 `https://github.com/<USERNAME>/<REPO>` ,则将 `base` 设置为 `"/<REPO>/"`
如果你准备发布到 `https://<USERNAME>.github.io/<REPO>/` ,也就是说你的仓库地址是 `https://github.com/<USERNAME>/<REPO>` ,则将 `base` 设置为 `"/<REPO>/"`

2. 选择你想要使用的 CI 工具。这里我们以 [GitHub Actions](https://github.com/features/actions) 为例。

创建 `.github/workflows/docs.yml` 文件来配置工作流。
创建 `.github/workflows/docs.yml` 文件来配置工作流。

::: details 点击展开配置样例
```yaml
Expand Down Expand Up @@ -91,9 +91,9 @@ jobs:
1. 设置正确的 [base](../reference/config.md#base) 选项。
如果你准备发布到 `https://<USERNAME>.gitlab.io/` ,你可以省略这一步,因此 `base` 默认就是 `"/"` 。
如果你准备发布到 `https://<USERNAME>.gitlab.io/` ,你可以省略这一步,因此 `base` 默认就是 `"/"` 。

如果你准备发布到 `https://<USERNAME>.gitlab.io/<REPO>/` ,也就是说你的仓库地址是 `https://gitlab.com/<USERNAME>/<REPO>` ,则将 `base` 设置为 `"/<REPO>/"`。
如果你准备发布到 `https://<USERNAME>.gitlab.io/<REPO>/` ,也就是说你的仓库地址是 `https://gitlab.com/<USERNAME>/<REPO>` ,则将 `base` 设置为 `"/<REPO>/"`。

2. 创建 `.gitlab-ci.yml` 文件来配置 [GitLab CI](https://about.gitlab.com/stages-devops-lifecycle/continuous-integration/) 工作流。

Expand Down
1 change: 0 additions & 1 deletion docs/zh/guide/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,6 @@ const line3 = 'This is line 3'

为了避免你的代码块被 Vue 编译, VuePress 默认会在你的代码块添加 [v-pre](https://v3.vuejs.org/api/directives.html#v-pre) 指令。这一默认行为可以在配置中关闭。


你可以在代码块添加 `:v-pre` / `:no-v-pre` 标记来覆盖配置项中的设置。

::: warning
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/guide/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'
export default {
plugins: [
googleAnalyticsPlugin({
id: 'G-XXXXXXXXXX'
id: 'G-XXXXXXXXXX',
}),
],
}
Expand Down
2 changes: 1 addition & 1 deletion docs/zh/reference/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

如果一个组件在 `setup()` 中直接使用 浏览器 / DOM API ,它会导致构建过程报错,因为这些 API 在 Node.js 的环境中是无法使用的。在这种情况下,你可以选择一种方式:

- 修改这个组件,只在 `onBeforeMount()``onMounted()` Hook 中使用 浏览器 / DOM API 。
- 修改这个组件,只在 `onBeforeMount()``onMounted()` Hook 中使用 浏览器 / DOM API 。
- 使用 `<ClientOnly>` 包裹这个组件。

## Content
Expand Down
5 changes: 4 additions & 1 deletion docs/zh/reference/default-theme/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,10 @@ export default {
{
text: 'Bundlers Reference',
collapsible: true,
children: ['/reference/bundler/vite.md', '/reference/bundler/webpack.md'],
children: [
'/reference/bundler/vite.md',
'/reference/bundler/webpack.md',
],
},
],
},
Expand Down
15 changes: 8 additions & 7 deletions docs/zh/reference/default-theme/markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
`type` 是必需的, `title` 和 `content` 是可选的。

支持的 `type` 有:
- `tip`
- `warning`
- `danger`
- `details`
- [CodeGroup](./components.md#codegroup) 和 [CodeGroupItem](./components.md#codegroupitem) 的别名:
- `code-group`
- `code-group-item`

- `tip`
- `warning`
- `danger`
- `details`
- [CodeGroup](./components.md#codegroup) 和 [CodeGroupItem](./components.md#codegroupitem) 的别名:
- `code-group`
- `code-group-item`

- 示例 1 (默认标题):

Expand Down
Loading

0 comments on commit fd836b1

Please sign in to comment.