Skip to content

Add Ability to specify how deep page headers should go #984

Closed
@bretterer

Description

@bretterer

Feature request

It would be nice to have the ability to specify how deep the extractHeaders method goes.
Currently, it has a hard coded value of ['h2', 'h3']
Our current markdown files use h4 as well in order to handle some table of contents for the page in sidebar form.

What problem does this feature solve?

When doing a table of contents in the sidebar, this feature would allow you to specify how deep the TOC should go based on headers.

What does the proposed API look like?

config.js

module.exports = {
    themeConfig: {
        parseHeaders: ['h2','h3','h4']
    }
}

How should this be implemented in your opinion?

The above would be a themeConfig option and will replace the default hard coded value located at
https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/prepare/Page.js#L92

Are you willing to work on this yourself?**

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions