{"id":26248,"library":"remark-lint-no-duplicate-headings","title":"remark-lint-no-duplicate-headings","description":"remark-lint rule to warn when headings with equivalent text appear in a Markdown document. Current stable version is 4.0.1. Part of the remark-lint ecosystem, this plugin is ESM-only, requires Node.js 16+, and is included in the `remark-preset-lint-markdown-style-guide` preset. It helps screen reader users and prevents fragile automatic heading IDs. Unlike custom checks, it integrates directly with unified pipelines and CLI.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","duplicate","heading","lint","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-no-duplicate-headings","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-no-duplicate-headings","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-no-duplicate-headings","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for integration with remark-lint pipeline","package":"unified","optional":false},{"reason":"Required to register and run lint rules","package":"remark-lint","optional":false}],"imports":[{"note":"Package is ESM-only since v3; CommonJS require will fail.","wrong":"const remarkLintNoDuplicateHeadings = require('remark-lint-no-duplicate-headings')","symbol":"remarkLintNoDuplicateHeadings","correct":"import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings'"},{"note":"Default export, not named.","wrong":"import { remarkLintNoDuplicateHeadings } from 'remark-lint-no-duplicate-headings'","symbol":"remarkLintNoDuplicateHeadings","correct":"import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings'"},{"note":"The plugin accepts no options, so no types are exported.","wrong":"Attempting to import types separately like `import type { Options } from 'remark-lint-no-duplicate-headings'`","symbol":"Type definitions","correct":"No type imports needed; types are shipped with package."}],"quickstart":{"code":"import { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport remarkLint from 'remark-lint'\nimport remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings'\nimport { read } from 'to-vfile'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintNoDuplicateHeadings)\n  .use(remarkStringify)\n  .process(await read('example.md'))\n\nconsole.error(reporter(file))","lang":"typescript","description":"Runs linting on example.md, reporting duplicate headings. ESM-only, Node 16+."},"warnings":[{"fix":"Use import syntax or dynamic import().","message":"Package is ESM-only since v3; CommonJS require() will throw.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Remove any options object from .use(remarkLintNoDuplicateHeadings).","message":"Plugin accepts no options; attempting to pass options will be ignored.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure exact text match for detection.","message":"Comparison is case-sensitive and includes leading/trailing whitespace; headings that differ only in case or whitespace are not flagged.","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":"Switch to ESM imports or use dynamic import().","cause":"Using CommonJS require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Use `import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings'`.","cause":"Importing named export instead of default.","error":"TypeError: (0 , remarkLintNoDuplicateHeadings) is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}