Registry / testing / remark-lint-heading-word-length

remark-lint-heading-word-length

JSON →
library3.0.0jsnpmunverified

A remark-lint rule that warns when headings contain too many or too few words. Version 3.0.0 is current; breaking change drops Node <20.18.0. Words are split on whitespace. Unlike the archived remark-lint-heading-length, this rule supports configurable min/max word counts. ESM-only. Part of the unified-utils monorepo with semantic-release.

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

lintHeadingWordLength
import lintHeadingWordLength from 'remark-lint-heading-word-length'
const lintHeadingWordLength = require('remark-lint-heading-word-length')
ESM-only package; CommonJS require() will throw MODULE_NOT_FOUND.
default import
import lintHeadingWordLength from 'remark-lint-heading-word-length'
import { lintHeadingWordLength } from 'remark-lint-heading-word-length'
The package exports a single default function, not a named export.
plugin name in config
"lint-heading-word-length"
"remark-lint-heading-word-length"
In .remarkrc or package.json plugins array, use the short name without 'remark-lint-'. This matches the plugin's `remarkLint` convention.

Loads a markdown file, lints headings for word count, and prints errors using vfile-reporter.

import { read } from 'to-vfile'; import { reporter } from 'vfile-reporter'; import { remark } from 'remark'; import remarkLint from 'remark-lint'; import lintHeadingWordLength from 'remark-lint-heading-word-length'; const file = await remark() .use(remarkLint) .use(lintHeadingWordLength, { minimumWords: 3, maximumWords: 12 }) .process(await read('example.md')); console.log(reporter(file));
Debug
Known issues
breakingMinimum Node version now 20.18.0
fix
Upgrade Node to 20.18.0 or later.
affects: >=3.0.0
breakingPackage is now ESM-only
fix
Switch from require() to import. If you must use CommonJS, consider dynamic import() or stick with v2.x.
affects: >=3.0.0
deprecatedThe old 'remark-lint-heading-length' package is archived and no longer maintained
fix
Migrate to remark-lint-heading-word-length for active development and new features.
affects: all
gotchaPlugin short name 'lint-heading-word-length' must be used in config (not full package name)
fix
Use 'lint-heading-word-length' in .remarkrc or package.json plugins array.
affects: all
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Attempting to use CommonJS require() on ESM-only package.
fix
Replace 'const ... = require(...)' with 'import ... from ...'
TypeError: plugin is not a function
Using the full npm package name as plugin key in remark config.
fix
Use 'lint-heading-word-length' instead of 'remark-lint-heading-word-length'.
Upgrade
Version history
3.0.0latest on npm
Audit
Dependencies
unified-lint-rulerequiredProvides the lint rule base class and message API.
Agent activity
8 hits · last 30 days
node
6
OpenAI (training)
2
Resources
remark-lint-heading-word-length — npm install remark-lint-heading-word-length · libregistry