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

remark-lint-maximum-heading-length

JSON →
library4.1.1jsnpmunverified

remark-lint rule to warn when headings are too long. Current stable version is 4.1.1 (ESM-only, requires Node.js 16+). Part of the unified/remark ecosystem, this rule enforces a maximum heading length (default 60 characters) and is included in some presets like remark-preset-lint-markdown-style-guide. Provides an optional stringLength function for custom text measurement (e.g., to count display width). Active development with regular releases coordinated across the remark-lint monorepo.

npm install remark-lint-maximum-heading-length
INSTALL
IMPORT
SIG · REMARK-LINT-MAXIMU
R
remark-lint-maximum-heading-length
testingjavascriptv4.1.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.

remarkLintMaximumHeadingLength
import remarkLintMaximumHeadingLength from 'remark-lint-maximum-heading-length'
const remarkLintMaximumHeadingLength = require('remark-lint-maximum-heading-length')
Package is ESM-only since v4. Use dynamic import() in CommonJS environments.
Options (type)
import type { Options } from 'remark-lint-maximum-heading-length'
import { Options } from 'remark-lint-maximum-heading-length'
Options is a TypeScript type only; do not use value import.

Shows how to use the rule with unified, specifying a custom max heading length of 80 characters.

import remarkLint from 'remark-lint' import remarkLintMaximumHeadingLength from 'remark-lint-maximum-heading-length' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import { read } from 'to-vfile' import { unified } from 'unified' import { reporter } from 'vfile-reporter' const file = await read('example.md') await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintMaximumHeadingLength, { size: 80 }) .use(remarkStringify) .process(file) console.error(reporter(file))
Debug
Known issues
breakingESM-only since v4; CommonJS require() will throw.
fix
Use import or dynamic import(). For Node.js <16, upgrade or stay on v3.
affects: >=4.0.0
breakingOptions structure changed: previously passed as number (max length), now must be an object with `size` property.
fix
Change `.use(remarkLintMaximumHeadingLength, 60)` to `.use(remarkLintMaximumHeadingLength, { size: 60 })`.
affects: >=4.0.0
deprecatedPlugin no longer exports `remarkLintMaximumHeadingLength` as a named export; only default export.
fix
Use default import: `import remarkLintMaximumHeadingLength from 'remark-lint-maximum-heading-length'`.
affects: >=4.0.0
gotchaIf using with a preset that overrides options, ensure your options object is merged correctly.
fix
Explicitly pass options after the preset.
affects: >=3.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module ... from ... not supported.
Package is ESM-only since v4, but used with require().
fix
Change require() to import or use dynamic import().
TypeError: Cannot read properties of undefined (reading 'length')
Passing a number directly instead of options object in v4+.
fix
Use `.use(remarkLintMaximumHeadingLength, { size: 60 })` instead of `.use(remarkLintMaximumHeadingLength, 60)`.
Upgrade
Version history
4.1.1latest on npm
Audit
Dependencies
remark-lintrequiredRequired peer dependency; this is a plugin for remark-lint
unifiedrequiredRequired peer dependency; remark-lint builds on unified
remark-parserequiredRequired to parse Markdown; needed for any lint rule
Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-maximum-heading-length — npm install remark-lint-maximum-heading-length · libregistry