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

remark-lint-no-duplicate-headings-in-section

JSON →
library4.0.1jsnpmunverified

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.

npm install remark-lint-no-duplicate-headings-in-section
INSTALL
IMPORT
SIG · REMARK-LINT-NO-DUP
R
remark-lint-no-duplicate-headings-in-section
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.

remarkLintNoDuplicateHeadingsInSection
import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section'
const remarkLintNoDuplicateHeadingsInSection = require('remark-lint-no-duplicate-headings-in-section')
Package is ESM-only since v4, use import instead of require.
remarkLintNoDuplicateHeadingsInSection (default export)
import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section'
import { remarkLintNoDuplicateHeadingsInSection } from 'remark-lint-no-duplicate-headings-in-section'
This package exports a single default export, not a named export.
use in unified pipeline
.use(remarkLintNoDuplicateHeadingsInSection)
.use(remarkLintNoDuplicateHeadingsInSection, {})
This rule has no options; passing empty object is unnecessary but does not break.

Shows how to use the rule with unified to detect duplicate headings in a section.

import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import remarkLint from 'remark-lint' import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section' import { reporter } from 'vfile-reporter' const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintNoDuplicateHeadingsInSection) .use(remarkStringify) .process('# Planets\n\n## Mars\n\n### Discovery\n\n### Discovery') console.error(reporter(file))
Debug
Known issues
breakingPackage is ESM-only since version 4.0.0. CommonJS require() will fail.
fix
Switch to import syntax. Use dynamic import() if necessary.
affects: >=4.0.0
gotchaThe rule does not check for duplicate headings across different sections; only within the same section, respecting heading hierarchy.
fix
Understand that duplicate headings in different sections are allowed. Use remark-lint-no-duplicate-headings if you want global uniqueness.
affects: *
deprecatedNo deprecation warnings as of version 4.0.1.
fix
N/A
affects: none
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Using require() on an ESM-only package.
fix
Import using import syntax or use dynamic import().
TypeError: remarkLintNoDuplicateHeadingsInSection is not a function
Using named import instead of default import.
fix
Use default import: import remarkLintNoDuplicateHeadingsInSection from 'remark-lint-no-duplicate-headings-in-section'
Cannot find module 'remark-lint-no-duplicate-headings-in-section'
Package not installed in node_modules.
fix
Run npm install remark-lint-no-duplicate-headings-in-section
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
unifiedrequiredRequired to use the plugin as a remark-lint rule
remark-lintrequiredThe plugin integrates with remark-lint; needed for linting
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-no-duplicate-headings-in-section — npm install remark-lint-no-duplicate-headings-in-section · libregistry