Registry / testing / remark-lint-no-duplicate-headings

remark-lint-no-duplicate-headings

JSON →
library4.0.1jsnpmunverified

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.

npm install remark-lint-no-duplicate-headings
INSTALL
IMPORT
SIG · REMARK-LINT-NO-DUP
R
remark-lint-no-duplicate-headings
testingjavascriptv4.0.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

remarkLintNoDuplicateHeadings
import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings'
const remarkLintNoDuplicateHeadings = require('remark-lint-no-duplicate-headings')
Package is ESM-only since v3; CommonJS require will fail.
remarkLintNoDuplicateHeadings
import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings'
import { remarkLintNoDuplicateHeadings } from 'remark-lint-no-duplicate-headings'
Default export, not named.
Type definitions
No type imports needed; types are shipped with package.
Attempting to import types separately like `import type { Options } from 'remark-lint-no-duplicate-headings'`
The plugin accepts no options, so no types are exported.

Runs linting on example.md, reporting duplicate headings. ESM-only, Node 16+.

import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import remarkLint from 'remark-lint' import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings' import { read } from 'to-vfile' import { reporter } from 'vfile-reporter' const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintNoDuplicateHeadings) .use(remarkStringify) .process(await read('example.md')) console.error(reporter(file))
remark --version
Debug
Known issues
breakingPackage is ESM-only since v3; CommonJS require() will throw.
fix
Use import syntax or dynamic import().
affects: >=3.0.0
gotchaPlugin accepts no options; attempting to pass options will be ignored.
fix
Remove any options object from .use(remarkLintNoDuplicateHeadings).
affects: >=1.0.0
gotchaComparison is case-sensitive and includes leading/trailing whitespace; headings that differ only in case or whitespace are not flagged.
fix
Ensure exact text match for detection.
affects: >=1.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using CommonJS require() on an ESM-only package.
fix
Switch to ESM imports or use dynamic import().
TypeError: (0 , remarkLintNoDuplicateHeadings) is not a function
Importing named export instead of default.
fix
Use `import remarkLintNoDuplicateHeadings from 'remark-lint-no-duplicate-headings'`.
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
unifiedrequiredPeer dependency for integration with remark-lint pipeline
remark-lintrequiredRequired to register and run lint rules
Agent activity
2 hits · last 30 days
node
2
Resources