heading-level
Angular templatesHTMLVue / SvelteVue / Sveltecorrectnessno fixdefault: offhtml/html-eslint-recommended
What it does
Section titled “What it does”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).
Why it matters
Section titled “Why it matters”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.
Example
Section titled “Example”...<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>Configuration
Section titled “Configuration”angular: lint: rules: heading-level: warn # off (default), warn, errorhtml: lint: rules: heading-level: warn # off (default), warn, errorsvelte: lint: rules: heading-level: warn # off (default), warn, errorvue: lint: rules: heading-level: warn # off (default), warn, errorEnabled 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.
Upstream equivalents
Section titled “Upstream equivalents”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 |