Registry / testing / remark-lint-heading-style

remark-lint-heading-style

JSON →
library4.0.1jsnpmunverified

A remark-lint rule that warns when Markdown headings violate a specified or consistent style (ATX, ATX-closed, or setext). Version 4.0.1 is the latest stable release, part of the remark-lint ecosystem. It is ESM-only (Node 16+). Unlike alternatives like markdownlint, it integrates seamlessly with unified and remark, allowing programmatic linting and fixes. It supports automatic style detection (consistent) and explicit configuration. The package ships TypeScript types and is commonly used in presets like remark-preset-lint-consistent and remark-preset-lint-markdown-style-guide.

npm install remark-lint-heading-style
INSTALL
IMPORT
SIG · REMARK-LINT-HEADIN
R
remark-lint-heading-style
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.

remarkLintHeadingStyle
✓ import remarkLintHeadingStyle from 'remark-lint-heading-style'
✗ import { remarkLintHeadingStyle } from 'remark-lint-heading-style'
Default export only; named export will fail. ESM-only since v4.
Options
✓ import type { Options } from 'remark-lint-heading-style'
✗ import { Options } from 'remark-lint-heading-style'
TypeScript type, not a runtime value; use import type.
Style
✓ import type { Style } from 'remark-lint-heading-style'
TypeScript type; valid values: 'atx', 'atx-closed', 'setext'.

Demonstrates unified pipeline to parse, lint headings for ATX style, and output warnings using vfile-reporter.

import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import remarkLint from 'remark-lint' import remarkLintHeadingStyle from 'remark-lint-heading-style' import { read } from 'to-vfile' import { reporter } from 'vfile-reporter' const file = await read('example.md') await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintHeadingStyle, 'atx') // or 'consistent' (default) .use(remarkStringify) .process(file) console.error(reporter(file))
Debug
Known issues
breakingESM-only since v4; requires Node 16+ and cannot be used with CommonJS require().
fix
Switch to ES modules: use 'import' instead of 'require()'. Set type: 'module' in package.json or use .mjs extension.
affects: >=4.0.0
deprecatedThe older style option 'consistent' is deprecated in favor of explicit style or 'consistent' string? Actually, 'consistent' is still valid but may change in future major versions.
fix
Use explicit style like 'atx' or 'setext' to be safe.
affects: >=4.0.0
gotchaThe rule only checks top-level headings; nested headings inside blockquotes or list items may not be linted consistently across all versions.
fix
Ensure the markdown structure is flat or test edge cases; consider using remark-lint with other plugins.
affects: *
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported
Using CommonJS require() on an ESM-only package.
fix
Use dynamic import() or switch to ES modules. Set 'type': 'module' in package.json.
TypeError: remarkLintHeadingStyle is not a function
Named import instead of default import.
fix
Use: import remarkLintHeadingStyle from 'remark-lint-heading-style'
Cannot find module 'remark-lint'
Missing peer dependency remark-lint.
fix
Install remark-lint alongside: npm install remark-lint remark-lint-heading-style
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies
remark-lintrequiredCore linting infrastructure required for rule to operate
unifiedrequiredUnified ecosystem dependency for processing pipelines
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-heading-style — npm install remark-lint-heading-style · libregistry