diff --git a/packages/docs/docs/config/README.md b/packages/docs/docs/config/README.md index 9ee0aa6663..ae7348eb7e 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: 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