{"id":26246,"library":"remark-lint-no-duplicate-headings-in-section","title":"remark-lint-no-duplicate-headings-in-section","description":"A remark-lint rule that warns when the same heading text appears multiple times within a single section. Version 4.0.1 is the current stable release. This package is part of the remark-lint ecosystem, which provides a variety of linting rules for markdown. It helps ensure heading uniqueness per section, catching potential duplication mistakes. Unlike other lint rules that check overall duplicate headings, this rule scopes duplicates to sections, allowing the same heading text in different sections. It supports MDX and is ESM-only from version 4+. Install via npm, use with unified processor or 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","section","typescript"],"install":[{"cmd":"npm install remark-lint-no-duplicate-headings-in-section","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-no-duplicate-headings-in-section","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-no-duplicate-headings-in-section","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Required to use the plugin as a remark-lint rule","package":"unified","optional":false},{"reason":"The plugin integrates with remark-lint; needed for linting","package":"remark-lint","optional":false}],"imports":[{"note":"Package is ESM-only since v4, use import instead of require.","wrong":"const remarkLintNoDuplicateHeadingsInSection = require('remark-lint-no-duplicate-headings-in-section')","symbol":"remarkLintNoDuplicateHeadingsInSection","correct":"import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section'"},{"note":"This package exports a single default export, not a named export.","wrong":"import { remarkLintNoDuplicateHeadingsInSection } from 'remark-lint-no-duplicate-headings-in-section'","symbol":"remarkLintNoDuplicateHeadingsInSection (default export)","correct":"import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section'"},{"note":"This rule has no options; passing empty object is unnecessary but does not break.","wrong":".use(remarkLintNoDuplicateHeadingsInSection, {})","symbol":"use in unified pipeline","correct":".use(remarkLintNoDuplicateHeadingsInSection)"}],"quickstart":{"code":"import { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport remarkLint from 'remark-lint'\nimport remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintNoDuplicateHeadingsInSection)\n  .use(remarkStringify)\n  .process('# Planets\\n\\n## Mars\\n\\n### Discovery\\n\\n### Discovery')\n\nconsole.error(reporter(file))","lang":"typescript","description":"Shows how to use the rule with unified to detect duplicate headings in a section."},"warnings":[{"fix":"Switch to import syntax. Use dynamic import() if necessary.","message":"Package is ESM-only since version 4.0.0. CommonJS require() will fail.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Understand that duplicate headings in different sections are allowed. Use remark-lint-no-duplicate-headings if you want global uniqueness.","message":"The rule does not check for duplicate headings across different sections; only within the same section, respecting heading hierarchy.","severity":"gotcha","affected_versions":"*"},{"fix":"N/A","message":"No deprecation warnings as of version 4.0.1.","severity":"deprecated","affected_versions":"none"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Import using import syntax or use dynamic import().","cause":"Using require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module"},{"fix":"Use default import: import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section'","cause":"Using named import instead of default import.","error":"TypeError: remarkLintNoDuplicateHeadingsInSection is not a function"},{"fix":"Run npm install remark-lint-no-duplicate-headings-in-section","cause":"Package not installed in node_modules.","error":"Cannot find module 'remark-lint-no-duplicate-headings-in-section'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}