Skip to content

heading-level

Reports a heading that breaks the outline of the document: the first heading is not an <h1>, a level is skipped going down (<h1> then <h3>), or the page has more than one <h1> (each one is reported).

Headings make the table of contents that screen reader users and search engines build. A skipped level suggests a section that is missing, and several <h1> leave the main topic unclear.

To fix, use the level that follows the one above, and style the size with CSS.

Reported
...
<meta http-equiv="refresh" content="0; url=/new">
</head>
<body>
<h2>a</h2>
<h1>b</h1>
<h3>c</h3>
<h2>d</h2>
<h1>e</h1>
</body>
</html>
angular:
lint:
rules:
heading-level: warn # off (default), warn, error
html:
lint:
rules:
heading-level: warn # off (default), warn, error
svelte:
lint:
rules:
heading-level: warn # off (default), warn, error
vue:
lint:
rules:
heading-level: warn # off (default), warn, error

Enabled by the presets: html/html-eslint-recommended.

Suppress one line with sudsy-disable-next-line heading-level in a comment of the file’s language.

The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.

Tool Rule Match What differs
html-eslint no-multiple-h1 partial also reports the other heading rules of heading-level
html-eslint no-skip-heading-levels partial also reports a first heading that is not an h1 and a second h1
html-validate heading-level partial a sectioning root (<dialog>, <section> with its own outline) does not reset the levels; no allowMultipleH1 and minInitialRank options