{"id":26216,"library":"remark-lint-heading-increment","title":"remark-lint-heading-increment","description":"A remark-lint rule that warns when heading levels increase by more than one level at a time (e.g., from h1 to h3). This helps enforce accessible heading hierarchies as recommended by HTML accessibility guidelines, where headings should increment by one level. Part of the remark-lint ecosystem, current stable version is 4.0.1 (ESM-only since v2, ships TypeScript types). Released as part of the remark-lint monorepo with regular updates. No options needed. Integrates with remark-lint presets like remark-preset-lint-markdown-style-guide.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","heading","increase","increment","lint","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-heading-increment","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-heading-increment","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-heading-increment","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to integrate with the remark linting framework","package":"remark-lint","optional":false},{"reason":"The plugin is a unified (remark) plugin","package":"unified","optional":false}],"imports":[{"note":"This package is ESM-only. Default export. CommonJS require is not supported. The function is used as a plugin: .use(remarkLintHeadingIncrement).","wrong":"const { remarkLintHeadingIncrement } = require('remark-lint-heading-increment')","symbol":"remarkLintHeadingIncrement","correct":"import remarkLintHeadingIncrement from 'remark-lint-heading-increment'"},{"note":"The remark-lint package is also ESM-only. Must be imported and used before individual lint rules.","wrong":"const remarkLint = require('remark-lint')","symbol":"remarkLint","correct":"import remarkLint from 'remark-lint'"},{"note":"unified package is ESM-only since v10. Use named import.","wrong":"const unified = require('unified')","symbol":"unified","correct":"import { unified } from 'unified'"}],"quickstart":{"code":"import { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport remarkLint from 'remark-lint'\nimport remarkLintHeadingIncrement from 'remark-lint-heading-increment'\nimport { read } from 'to-vfile'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await read('example.md')\n\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintHeadingIncrement)\n  .use(remarkStringify)\n  .process(file)\n\nconsole.error(reporter(file))","lang":"typescript","description":"Shows how to use remark-lint-heading-increment to lint a Markdown file for heading level jumps, outputting any warnings."},"warnings":[{"fix":"Use import or dynamic import() instead of require().","message":"Package is ESM-only; CommonJS require() will fail","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Remove any 'style' option; this rule now has no options.","message":"The option 'style' was removed in v3.0.0","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Do not add the rule manually if the preset is used; check preset documentation.","message":"When using with remark-preset-lint-markdown-style-guide, the preset may already include this rule, causing duplicate warnings","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If using TypeScript, ensure your project uses @import syntax and upgrade remark-lint types if needed.","message":"TypeScript types changed in v4.0.0 (refactored internal types for option coercion)","severity":"breaking","affected_versions":">=4.0.0 <5.0.0"},{"fix":"Combine with other lint rules if needed to enforce consistent structure.","message":"This rule only works on headings; it does not detect jumps in nested lists or other structures","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Insert an h2 heading between the h1 and h3, or adjust heading levels to increment by one.","cause":"Heading level jumped from h1 to h3 without an h2 in between.","error":"Unexpected heading rank `3`, exected rank `2`"},{"fix":"Use `import remarkLintHeadingIncrement from 'remark-lint-heading-increment'` or set `\"type\": \"module\"` in package.json.","cause":"Using CommonJS require() on ESM-only package.","error":"remark-lint-heading-increment is not a function"},{"fix":"Ensure `remark-lint`, `unified`, `remark-parse`, etc. are installed. Check that the import path is exactly `'remark-lint-heading-increment'`.","cause":"Missing dependencies or incorrect import path.","error":"ERR_MODULE_NOT_FOUND"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}