Skip to content

markdown.extractHeaders config option does not work #2071

Closed
@Otto-J

Description

@Otto-J
  • I confirm that this is an issue rather than a question.

Bug report

Steps to reproduce

** English is not very good **

try change option config.js to be: markdown.extractHeaders:["h1", "h2", "h3"], on Post page, try to get this.$page.headers still return h2 and h3

and I changed the file: node_modules/@vuepress/core/lib/node/Page.js line117:

const headers = extractHeaders(
          this._strippedContent,
          ['h1','h2', 'h3'], // add 'h1' to here.
          markdown
        )

it worked.

so, I think markdown.extractHeaders option does not work.

What is expected?

on post page, get this.$page.headers includes h1 level

What is actually happening?

Other relevant information

"vuepress": "^1.2.0"

in Chinese:

制作主题时候,想通过设置makdown.extractHeaders, 来 this.$page.headers 获取到所有的heading 标签,感觉是硬解码写成固定的了,配置的选项也不生效。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions