Skip to content

Commit cdfbc06

Browse files
committed
Merge branch 'main' into theme-hope
2 parents 15f941c + 5cfa771 commit cdfbc06

File tree

10 files changed

+1644
-1650
lines changed

10 files changed

+1644
-1650
lines changed

docs/guide/markdown.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ Following code blocks extensions are implemented during markdown parsing in Node
162162

163163
#### Code Title
164164

165-
You can specify the title of the code block by adding a `title` key-value mark in your fenced code blocks.
165+
You can specify the title of the code block by adding a `title` key-value mark in your fenced code blocks. Note: This requires theme support.
166166

167167
**Input**
168168

@@ -200,7 +200,7 @@ It can be used in combination with the other marks below. Please leave a space b
200200

201201
#### Line Highlighting
202202

203-
You can highlight specified lines of your code blocks by adding line ranges mark in your fenced code blocks:
203+
You can highlight specified lines of your code blocks by adding line ranges mark in your fenced code blocks. Note: This requires highlighter plugin and theme support.
204204

205205
**Input**
206206

@@ -248,9 +248,9 @@ Config reference: [markdown.code.highlightLines](../reference/config.md#markdown
248248

249249
#### Line Numbers
250250

251-
You must have noticed that the number of lines is displayed on the left side of code blocks. This is enabled by default and you can disable it in config.
251+
You must have noticed that the number of lines is displayed on the left side of code blocks.
252252

253-
You can add `:line-numbers` / `:no-line-numbers` mark in your fenced code blocks to override the value set in config.
253+
You can add `:line-numbers` / `:no-line-numbers` mark in your fenced code blocks to override the value set in config. Note: This requires highlighter plugin and theme support.
254254

255255
**Input**
256256

@@ -350,7 +350,7 @@ const onePlusTwoPlusThree = {{ 1 + 2 + 3 }}
350350
::: tip
351351
This v-pre extension is supported by our built-in plugin.
352352

353-
Config reference: [markdown.code.vPre.block](../reference/config.md#markdown-code-vpre-block)
353+
Config reference: [markdown.vPre.block](../reference/config.md#markdown-vpre-block)
354354
:::
355355

356356
### Import Code Blocks

docs/guide/migration.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ Renamed to `pagePatterns`
149149

150150
#### markdown.lineNumbers
151151

152-
Moved to [markdown.code.lineNumbers](../reference/config.md#markdown-code-linenumbers).
152+
Removed.
153153

154-
Default value is changed from `false` to `true`.
154+
The same feature is implemented in [@vuepress/plugin-prismjs][prismjs] and [@vuepress/plugin-shiki][shiki].
155155

156156
#### markdown.pageSuffix
157157

@@ -418,7 +418,7 @@ Some major breaking changes:
418418
- Always provide a valid js entry file, and do not use `"main": "layouts/Layout.vue"` as the theme entry anymore.
419419
- `themeConfig` is removed from user config and site data. To access the `themeConfig` as you would via `this.$site.themeConfig` in v1, we now recommend using the [@vuepress/plugin-theme-data](https://ecosystem.vuejs.press/plugins/theme-data.html) plugin and its `useThemeData` composition API.
420420
- Stylus is no longer the default CSS pre-processor, and the stylus palette system is not embedded. If you still want to use similar palette system as v1, [@vuepress/plugin-palette](https://ecosystem.vuejs.press/plugins/palette.html) may help.
421-
- Markdown code blocks syntax highlighting by Prism.js is not embedded by default. You can use either [@vuepress/plugin-prismjs](https://ecosystem.vuejs.press/plugins/prismjs.html) or [@vuepress/plugin-shiki](https://ecosystem.vuejs.press/plugins/shiki.html), or implement syntax highlighting in your own way.
421+
- Markdown code blocks syntax highlighting by Prism.js is not embedded by default. You can use either [@vuepress/plugin-prismjs][prismjs] or [@vuepress/plugin-shiki][shiki], or implement syntax highlighting in your own way.
422422
- For scalability concerns, `this.$site.pages` is not available any more. See [Advanced > Cookbook > Resolving Routes](../advanced/cookbook/resolving-routes.md) for how to retrieve pages data in v2.
423423

424424
For more detailed guide about how to write a theme in v2, see [Advanced > Writing a Theme](../advanced/theme.md).
@@ -442,3 +442,6 @@ You can still inherit a parent theme with `extends: parentTheme()`, which will e
442442
You can refer to [Default Theme > Extending](https://ecosystem.vuejs.press/themes/default/extending.html) for how to extend default theme.
443443

444444
The `@theme` and `@parent-theme` aliases are removed by default, but you can still make a extendable theme with similar approach, see [Advanced > Cookbook > Making a Theme Extendable](../advanced/cookbook/making-a-theme-extendable.md).
445+
446+
[prismjs]: https://ecosystem.vuejs.press/plugins/prismjs.html
447+
[shiki]: https://ecosystem.vuejs.press/plugins/shiki.html

docs/guide/plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ With the help of [Plugin API](../reference/plugin-api.md), VuePress plugin can p
1010

1111
VuePress team provides some official plugins.
1212

13-
You need to import and use them in your config file via the [plugins](../reference/config.md#plugins) option. For example, use the [@vuepress/plugin-google-analytics](https://ecosystem.vuejs.press/plugins/google-analytics.html) to integrate Google Analytics:
13+
You need to import and use them in your config file via the [plugins](../reference/config.md#plugins) option. For example, use the [@vuepress/plugin-google-analytics](https://ecosystem.vuejs.press/plugins/analytics/google-analytics.html) to integrate Google Analytics:
1414

1515
```ts
1616
import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'

docs/reference/config.md

Lines changed: 26 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -404,90 +404,6 @@ const defaultOptions = {
404404
You should not configure it unless you understand what it is for.
405405
:::
406406

407-
### markdown.code
408-
409-
- Type: `CodePluginOptions | false`
410-
411-
- Details:
412-
413-
Options for VuePress built-in markdown-it code plugin.
414-
415-
Set to `false` to disable this plugin.
416-
417-
- Also see:
418-
- [Guide > Markdown > Syntax Extensions > Code Blocks](../guide/markdown.md#code-blocks)
419-
420-
#### markdown.code.highlightLines
421-
422-
- Type: `boolean`
423-
424-
- Default: `true`
425-
426-
- Details:
427-
428-
Enable code line highlighting or not.
429-
430-
- Also see:
431-
- [Guide > Markdown > Syntax Extensions > Code Blocks > Line Highlighting](../guide/markdown.md#line-highlighting)
432-
433-
#### markdown.code.lineNumbers
434-
435-
- Type: `boolean | number`
436-
437-
- Default: `true`
438-
439-
- Details:
440-
441-
Configure code line numbers.
442-
443-
- A `boolean` value is to enable line numbers or not.
444-
- A `number` value is the minimum number of lines to enable line numbers. For example, if you set it to `4`, line numbers will only be enabled when your code block has at least 4 lines of code.
445-
446-
- Also see:
447-
- [Guide > Markdown > Syntax Extensions > Code Blocks > Line Numbers](../guide/markdown.md#line-numbers)
448-
449-
#### markdown.code.preWrapper
450-
451-
- Type: `boolean`
452-
453-
- Default: `true`
454-
455-
- Details:
456-
457-
Enable the extra wrapper of the `<pre>` tag or not.
458-
459-
The wrapper is required by the `highlightLines` and `lineNumbers`. That means, if you disable `preWrapper`, the line highlighting and line numbers will also be disabled.
460-
461-
::: tip
462-
You can disable it if you want to implement them in client side. For example, [Prismjs Line Highlight](https://prismjs.com/plugins/line-highlight/) or [Prismjs Line Numbers](https://prismjs.com/plugins/line-numbers/).
463-
:::
464-
465-
#### markdown.code.vPre.block
466-
467-
- Type: `boolean`
468-
469-
- Default: `true`
470-
471-
- Details:
472-
473-
Add `v-pre` directive to `<pre>` tag of code block or not.
474-
475-
- Also see:
476-
- [Guide > Markdown > Syntax Extensions > Code Blocks > Wrap with v-pre](../guide/markdown.md#wrap-with-v-pre)
477-
478-
#### markdown.code.vPre.inline
479-
480-
- Type: `boolean`
481-
482-
- Default: `true`
483-
484-
- Details:
485-
486-
Add `v-pre` directive to `<code>` tag of inline code or not.
487-
488-
- Also see:
489-
- [Guide > Markdown > Syntax Extensions > Code Blocks > Wrap with v-pre](../guide/markdown.md#wrap-with-v-pre)
490-
491407
### markdown.component
492408

493409
- Type: `undefined | false`
@@ -675,6 +591,32 @@ const defaultOptions = {
675591
- Also see:
676592
- [Guide > Markdown > Syntax Extensions > Table of Contents](../guide/markdown.md#table-of-contents)
677593

594+
#### markdown.vPre.block
595+
596+
- Type: `boolean`
597+
598+
- Default: `true`
599+
600+
- Details:
601+
602+
Add `v-pre` directive to `<pre>` tag of code block or not.
603+
604+
- Also see:
605+
- [Guide > Markdown > Syntax Extensions > Code Blocks > Wrap with v-pre](../guide/markdown.md#wrap-with-v-pre)
606+
607+
#### markdown.vPre.inline
608+
609+
- Type: `boolean`
610+
611+
- Default: `true`
612+
613+
- Details:
614+
615+
Add `v-pre` directive to `<code>` tag of inline code or not.
616+
617+
- Also see:
618+
- [Guide > Markdown > Syntax Extensions > Code Blocks > Wrap with v-pre](../guide/markdown.md#wrap-with-v-pre)
619+
678620
## Plugin Config
679621

680622
### plugins

docs/zh/guide/markdown.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ Emoji 扩展由 [markdown-it-emoji](https://github.com/markdown-it/markdown-it-e
163163

164164
#### 代码标题
165165

166-
你可以在代码块添加一个 `title` 键值对来为代码块设置标题。
166+
你可以在代码块添加一个 `title` 键值对来为代码块设置标题。提示:需要主题支持。
167167

168168
**Input**
169169

@@ -201,7 +201,7 @@ export default defineUserConfig({
201201

202202
#### 行高亮
203203

204-
你可以在代码块添加行数范围标记,来为对应代码行进行高亮
204+
你可以在代码块添加行数范围标记,来为对应代码行进行高亮。提示:它需要高亮器插件和主题支持。
205205

206206
**输入**
207207

@@ -249,7 +249,7 @@ export default defineUserConfig({
249249

250250
#### 行号
251251

252-
你肯定已经注意到在代码块的最左侧会展示行号。这个功能是默认启用的,你可以通过配置来禁用它。
252+
你肯定已经注意到在代码块的最左侧会展示行号。这个功能是默认启用的,你可以通过配置来禁用它。提示:它需要高亮器插件和主题支持。
253253

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

@@ -351,7 +351,7 @@ const onePlusTwoPlusThree = {{ 1 + 2 + 3 }}
351351
::: tip
352352
v-pre 扩展是由我们的内置插件支持的。
353353

354-
配置参考: [markdown.code.vPre.block](../reference/config.md#markdown-code-vpre-block)
354+
配置参考: [markdown.vPre.block](../reference/config.md#markdown-vpre-block)
355355
:::
356356

357357
### 导入代码块

docs/zh/guide/migration.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,9 @@ npm i -D @vuepress/theme-default@next
149149

150150
#### markdown.lineNumbers
151151

152-
移动至 [markdown.code.lineNumbers](../reference/config.md#markdown-code-linenumbers)
152+
移除
153153

154-
默认值从 `false` 更改为 `true`
154+
相同的功能改在 [@vuepress/plugin-prismjs][prismjs][@vuepress/plugin-shiki][shiki] 提供
155155

156156
#### markdown.pageSuffix
157157

@@ -420,7 +420,7 @@ v1 的主题和插件和 v2 并不兼容。
420420
- 你始终需要提供一个合法的 JS 入口文件,不要再使用 `"main": "layouts/Layout.vue"` 作为主题入口。
421421
- `themeConfig` 已经从用户配置和站点数据中移除。如果你想要像 v1 一样通过 `this.$site.themeConfig` 来访问 `themeConfig` ,我们现在建议使用 [@vuepress/plugin-theme-data](https://ecosystem.vuejs.press/zh/plugins/theme-data.html) 插件和它提供的 Composition API `useThemeData`
422422
- Stylus 不再是默认的 CSS 预处理器,并且 Stylus 调色板系统不再被默认支持。如果你仍然想要使用和 v1 类似的调色板系统,可以使用 [@vuepress/plugin-palette](https://ecosystem.vuejs.press/zh/plugins/palette.html)
423-
- 由 Prism.js 提供的 Markdown 代码块的语法高亮不再被默认支持。你可以选择使用 [@vuepress/plugin-prismjs](https://ecosystem.vuejs.press/zh/plugins/prismjs.html)[@vuepress/plugin-shiki](https://ecosystem.vuejs.press/zh/plugins/plugin/shiki.html) ,或者用你自己的方式实现语法高亮。
423+
- 由 Prism.js 提供的 Markdown 代码块的语法高亮不再被默认支持。你可以选择使用 [@vuepress/plugin-prismjs][prismjs][@vuepress/plugin-shiki][shiki] ,或者用你自己的方式实现语法高亮。
424424
- 考虑到可扩展性, `this.$site.pages` 不再可用。查看 [深入 > Cookbook > 解析路由](../advanced/cookbook/resolving-routes.md) 了解如何在 v2 中获取页面的数据。
425425

426426
你可以参考 [深入 > 开发主题](../advanced/theme.md) 来了解如何开发一个 v2 主题。
@@ -444,3 +444,6 @@ v1 的主题和插件和 v2 并不兼容。
444444
你可以参考 [默认主题 > 继承](https://ecosystem.vuejs.press/zh/themes/default/extending.html) 来了解如何继承默认主题。
445445

446446
`@theme``@parent-theme` 别名默认被移除了,但你仍然可以使用类似的方式来开发一个可继承的主题,参考 [深入 > Cookbook > 开发一个可继承的主题](../advanced/cookbook/making-a-theme-extendable.md)
447+
448+
[prismjs]: https://ecosystem.vuejs.press/zh/plugins/prismjs.html
449+
[shiki]: https://ecosystem.vuejs.press/zh/plugins/shiki.html

docs/zh/guide/plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ icon: fa6-solid:plug
1010

1111
VuePress 团队提供了一些官方插件。
1212

13-
你需要在你的配置文件中通过 [plugins](../reference/config.md#plugins) 配置项来使用它们。举例来说,你可以使用 [@vuepress/plugin-google-analytics](https://ecosystem.vuejs.press/zh/plugins/google-analytics.html) 来使用 Google Analytics :
13+
你需要在你的配置文件中通过 [plugins](../reference/config.md#plugins) 配置项来使用它们。举例来说,你可以使用 [@vuepress/plugin-google-analytics](https://ecosystem.vuejs.press/zh/plugins/analytics/google-analytics.html) 来使用 Google Analytics :
1414

1515
```ts
1616
import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'

docs/zh/reference/config.md

Lines changed: 26 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -403,90 +403,6 @@ const defaultOptions = {
403403
除非你了解它的用途,否则你不应该设置该配置项。
404404
:::
405405

406-
### markdown.code
407-
408-
- 类型: `CodePluginOptions | false`
409-
410-
- 详情:
411-
412-
VuePress 内置的 markdown-it code 插件的配置项。
413-
414-
设置为 `false` 可以禁用该插件。
415-
416-
- 参考:
417-
- [指南 > Markdown > 语法扩展 > 代码块](../guide/markdown.md#代码块)
418-
419-
#### markdown.code.highlightLines
420-
421-
- 类型: `boolean`
422-
423-
- 默认值: `true`
424-
425-
- 详情:
426-
427-
是否启用代码块行高亮。
428-
429-
- 参考:
430-
- [指南 > Markdown > 语法扩展 > 代码块 > 行高亮](../guide/markdown.md#行高亮)
431-
432-
#### markdown.code.lineNumbers
433-
434-
- 类型: `boolean | number`
435-
436-
- 默认值: `true`
437-
438-
- 详情:
439-
440-
配置代码块行号。
441-
442-
- 布尔值 `boolean` 代表是否启用代码块行号。
443-
- 数字 `number` 代表显示行号所需的最少行数。例如,如果你将它设置为 `4` ,那么只有在你的代码块包含至少 4 行代码时才会启用行号。
444-
445-
- 参考:
446-
- [指南 > Markdown > 语法扩展 > 代码块 > 行号](../guide/markdown.md#行号)
447-
448-
#### markdown.code.preWrapper
449-
450-
- 类型: `boolean`
451-
452-
- 默认值: `true`
453-
454-
- 详情:
455-
456-
是否在 `<pre>` 标签外额外包裹一层。
457-
458-
`highlightLines``lineNumbers` 依赖于这个额外的包裹层。这换句话说,如果你禁用了 `preWrapper` ,那么行高亮和行号也会被同时禁用。
459-
460-
::: tip
461-
如果你想要在客户端来实现这些功能时,可以禁用该配置项。比如使用 [Prismjs Line Highlight](https://prismjs.com/plugins/line-highlight/) 或者 [Prismjs Line Numbers](https://prismjs.com/plugins/line-numbers/)
462-
:::
463-
464-
#### markdown.code.vPre.block
465-
466-
- 类型: `boolean`
467-
468-
- 默认值: `true`
469-
470-
- 详情:
471-
472-
是否在代码块的 `<pre>` 标签上添加 `v-pre` 指令。
473-
474-
- 参考:
475-
- [指南 > Markdown > 语法扩展 > 代码块 > 添加 v-pre](../guide/markdown.md#添加-v-pre)
476-
477-
#### markdown.code.vPre.inline
478-
479-
- 类型: `boolean`
480-
481-
- 默认值: `true`
482-
483-
- 详情:
484-
485-
是否在行内代码的 `<code>` 标签上添加 `v-pre` 指令。
486-
487-
- 参考:
488-
- [指南 > Markdown > 语法扩展 > 代码块 > 添加 v-pre](../guide/markdown.md#添加-v-pre)
489-
490406
### markdown.component
491407

492408
- 类型: `undefined | false`
@@ -674,6 +590,32 @@ const defaultOptions = {
674590
- 参考:
675591
- [指南 > Markdown > 语法扩展 > 目录](../guide/markdown.md#目录)
676592

593+
#### markdown.vPre.block
594+
595+
- 类型: `boolean`
596+
597+
- 默认值: `true`
598+
599+
- 详情:
600+
601+
是否在代码块的 `<pre>` 标签上添加 `v-pre` 指令。
602+
603+
- 参考:
604+
- [指南 > Markdown > 语法扩展 > 代码块 > 添加 v-pre](../guide/markdown.md#添加-v-pre)
605+
606+
#### markdown.vPre.inline
607+
608+
- 类型: `boolean`
609+
610+
- 默认值: `true`
611+
612+
- 详情:
613+
614+
是否在行内代码的 `<code>` 标签上添加 `v-pre` 指令。
615+
616+
- 参考:
617+
- [指南 > Markdown > 语法扩展 > 代码块 > 添加 v-pre](../guide/markdown.md#添加-v-pre)
618+
677619
## 插件配置
678620

679621
### plugins

0 commit comments

Comments
 (0)