Skip to content

Feature request: new linter to enforce heading order #123

@dkniffin

Description

@dkniffin

I'm not sure if this is possible, but I want to throw it out there in case it is.

It would be nice to have the linter catch when you use header levels in a way which is inconsistent with accessibility rules and SEO. A few examples

Example 1 - h1 after h2

Bad

h2 Subheader
h1 Header

Good

h1 Header
h2 Subheader

Example 2 - skip header levels

Bad

h1 Header
h3 Sub-subheader

Good

h1 Header
h2 Subheader
h3 Sub-subheader

Example 2 - missing h1

Bad

h2 Subheader
h3 Sub-subheader

Good

h1 Header
h2 Subheader
h3 Sub-subheader

Thinking about how this would be implemented, I'm not sure if it's possible because of render. It wouldn't be able to detect if a header is inside of another file. But I think there could at least be a simple version of example 1.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions