Registry / testing / remark-lint-heading-length

remark-lint-heading-length

JSON →
library1.0.0jsnpmunverified

A remark-lint rule to enforce a minimum and maximum number of words in headings in Markdown files. Version 1.0.0 is the current stable release, based on the unified ecosystem. It allows configuration of min and max word counts, with defaults of 2 and 10 respectively. Unlike generic linters, this rule is specific to heading length and integrates seamlessly with remark-lint presets.

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

remarkLintHeadingLength
import remarkLintHeadingLength from 'remark-lint-heading-length'
const { remarkLintHeadingLength } = require('remark-lint-heading-length')
Default export; ESM-only since v1. CommonJS require cannot destructure.
default
import remarkLintHeadingLength from 'remark-lint-heading-length'
import { default as remarkLintHeadingLength } from 'remark-lint-heading-length'
Named default import works but is unnecessary; use default import directly.
remarkLint
import { remarkLint } from 'remark-lint'
import remarkLint from 'remark-lint'
remark-lint is a preset; use named export for the plugin function.

Configures remark-lint with the heading-length rule, then processes a Markdown string to show linting output.

import { remark } from 'remark'; import remarkLint from 'remark-lint'; import remarkLintHeadingLength from 'remark-lint-heading-length'; const file = await remark() .use(remarkLint) .use(remarkLintHeadingLength, ['error', { min: 3, max: 12 }]) .process('# Too short'); console.log(file.messages); // Message: Heading must have at least 3 words
Debug
Known issues
gotchaConfiguration must be an array with severity and options; passing plain object fails silently.
fix
Use array format: [severity, options] or just severity string.
affects: >=1.0.0
gotchaDefault min/max may not suit all projects; headings like 'Introduction' (1 word) will trigger warnings.
fix
Configure min to 1 if single-word headings are acceptable.
affects: >=1.0.0
deprecatedThis package is part of the deprecated remark-lint v8 line; consider migrating to unified and eslint-plugin-markdown.
fix
Use eslint-plugin-markdown or unified-based linters instead.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'remark-lint-heading-length'
Package not installed or missing from dependencies.
fix
Run: npm install remark-lint-heading-length
TypeError: plugin is not a function
Importing the package incorrectly (e.g., destructuring a non-default export).
fix
Use default import: import remarkLintHeadingLength from 'remark-lint-heading-length'
Error: Illegal configuration for remark-lint-heading-length
Passing configuration as a plain object instead of array.
fix
Use array format: ['error', { min: 2, max: 10 }]
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
remark-lintrequiredCore linting framework required for rule registration and execution
unifiedrequiredUnderlying processor for parsing and transforming Markdown
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-heading-length — npm install remark-lint-heading-length · libregistry