From 5f1b2cd3a6ab205a4928b6d96208d1e3f2541cef Mon Sep 17 00:00:00 2001 From: Franck Date: Fri, 25 Oct 2019 10:13:53 +0200 Subject: [PATCH 1/3] fix($docs): Move extractHeader documentation in the right section --- packages/docs/docs/config/README.md | 15 +++++++++++++++ packages/docs/docs/theme/default-theme-config.md | 11 ----------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/packages/docs/docs/config/README.md b/packages/docs/docs/config/README.md index 9ee0aa6663..ee6cac34ed 100644 --- a/packages/docs/docs/config/README.md +++ b/packages/docs/docs/config/README.md @@ -300,6 +300,21 @@ module.exports = { This option is also included in [Plugin API](../plugin/option-api.md#extendmarkdown). ::: +### markdown.extractHeaders + +- Type: `Array` +- Default: `['h2', 'h3']` + +While preparing the page, headers are extracted from the Markdown file and stored in `this.$page.headers`. By default, VuePress will extract `h2` and `h3` elements for you. You can override the headers it pulls out in your `markdown` options. + + ``` js +module.exports = { + markdown: { + extractHeaders: [ 'h2', 'h3', 'h4' ] + } +} +``` + ## Build Pipeline :::tip Configuring CSS Pre-processors diff --git a/packages/docs/docs/theme/default-theme-config.md b/packages/docs/docs/theme/default-theme-config.md index c83410345b..0e3878f593 100644 --- a/packages/docs/docs/theme/default-theme-config.md +++ b/packages/docs/docs/theme/default-theme-config.md @@ -182,17 +182,6 @@ module.exports = { } ``` -### Extract Headers - While preparing the page, headers are extracted from the Markdown file and stored in `this.$page.headers`. By default, VuePress will extract `h2` and `h3` elements for you. - You can override the headers it pulls out in your `markdown` options. - ``` js -module.exports = { - markdown: { - extractHeaders: [ 'h2', 'h3', 'h4' ] - } -} -``` - ### Active Header Links By default, the nested header links and the hash in the URL are updated as the user scrolls to view the different sections of the page. This behavior can be disabled with the following theme config: From 47902fa6fd60ade5d06eed6eb1409148a779d013 Mon Sep 17 00:00:00 2001 From: Franck Date: Fri, 25 Oct 2019 10:18:26 +0200 Subject: [PATCH 2/3] fix: Remove unecesary space --- packages/docs/docs/config/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/docs/docs/config/README.md b/packages/docs/docs/config/README.md index ee6cac34ed..ae7348eb7e 100644 --- a/packages/docs/docs/config/README.md +++ b/packages/docs/docs/config/README.md @@ -307,7 +307,7 @@ This option is also included in [Plugin API](../plugin/option-api.md#extendmarkd While preparing the page, headers are extracted from the Markdown file and stored in `this.$page.headers`. By default, VuePress will extract `h2` and `h3` elements for you. You can override the headers it pulls out in your `markdown` options. - ``` js +``` js module.exports = { markdown: { extractHeaders: [ 'h2', 'h3', 'h4' ] From ce7c0a7f38c466ef4c503c0423dba74cc76fef50 Mon Sep 17 00:00:00 2001 From: meteorlxy Date: Sat, 26 Oct 2019 12:03:35 +0800 Subject: [PATCH 3/3] docs: sync zh docs --- packages/docs/docs/zh/config/README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/packages/docs/docs/zh/config/README.md b/packages/docs/docs/zh/config/README.md index 79af789c04..ec815dc801 100644 --- a/packages/docs/docs/zh/config/README.md +++ b/packages/docs/docs/zh/config/README.md @@ -292,6 +292,21 @@ module.exports = { 这个选项也被 [Plugin API](../plugin/option-api.md#extendmarkdown) 所支持。 ::: +### markdown.extractHeaders + +- 类型: `Array` +- 默认值: `['h2', 'h3']` + +Markdown 文件的 headers (标题 & 小标题) 会在准备阶段被提取出来,并存储在 `this.$page.headers` 中。默认情况下,VuePress 会提取 `h2` 和 `h3` 标题。你可以通过这个选项来修改提取出的标题级别。 + +``` js +module.exports = { + markdown: { + extractHeaders: [ 'h2', 'h3', 'h4' ] + } +} +``` + ## 构建流程 ### postcss