Registry / testing / remark-lint-no-heading-punctuation

remark-lint-no-heading-punctuation

JSON →
library4.0.1jsnpmunverified

A remark-lint rule that warns when headings end in illegal characters such as punctuation marks. The current stable version is 4.0.1. It is part of the remark-lint ecosystem and is included in presets like `remark-preset-lint-markdown-style-guide`. It supports configurable options via a RegExp or string, allowing customization of which characters are flagged. This package is ESM-only and ships TypeScript types. It is actively maintained as part of the remark-lint monorepo.

npm install remark-lint-no-heading-punctuation
INSTALL
IMPORT
SIG · REMARK-LINT-NO-HEA
R
remark-lint-no-heading-punctuation
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.

default
import remarkLintNoHeadingPunctuation from 'remark-lint-no-heading-punctuation'
const remarkLintNoHeadingPunctuation = require('remark-lint-no-heading-punctuation')
Package is ESM-only since v4; CommonJS require will fail.
remarkLintNoHeadingPunctuation (used with .use)
import remarkLint from 'remark-lint' import remarkLintNoHeadingPunctuation from 'remark-lint-no-heading-punctuation' unified().use(remarkLint).use(remarkLintNoHeadingPunctuation)
unified().use(remarkLintNoHeadingPunctuation)
The rule must be used after the `remark-lint` plugin itself (or a preset that includes it).
TypeScript type import
import type { RemarkLintNoHeadingPunctuationOptions } from 'remark-lint-no-heading-punctuation'
The package does not export additional types aside from the default function; options can be typed inline.

Demonstrates usage of the remark-lint-no-heading-punctuation rule in a unified pipeline, processing a markdown file and reporting lint messages.

import { unified } from 'unified' import remarkParse from 'remark-parse' import remarkStringify from 'remark-stringify' import remarkLint from 'remark-lint' import remarkLintNoHeadingPunctuation from 'remark-lint-no-heading-punctuation' import { reporter } from 'vfile-reporter' const file = await unified() .use(remarkParse) .use(remarkLint) .use(remarkLintNoHeadingPunctuation) .use(remarkStringify) .process('# Mercury:') console.error(reporter(file)) // Output: 1:1-1:10: Unexpected character `:` at end of heading, remove it
Debug
Known issues
breakingSince version 4, the package is ESM-only and no longer supports CommonJS require().
fix
Use `import` syntax instead of `require()`. Ensure your project is ESM or use dynamic import().
affects: >=4.0.0
deprecatedOptions provided as a plain string are deprecated in favor of explicit RegExp or source object.
fix
Pass a RegExp or an object with `source` property: `{ source: '[,:;]' }`.
affects: >=4.0.0
gotchaWhen using a string option, it is wrapped in `new RegExp('[' + x + ']', 'u')` so characters like '.' need escaping.
fix
Use RegExp directly or escape regex special characters in the string.
affects: >=4.0.0
gotchaThe rule must be used after the `remark-lint` plugin; otherwise it will not work.
fix
Ensure `.use(remarkLint)` is called before `.use(remarkLintNoHeadingPunctuation)`.
affects: >=4.0.0
gotchaIn Node.js, the environment must support ESM (Node 16+).
fix
Use Node 16 or later, or use dynamic imports in older Node with `--experimental-modules`.
affects: >=4.0.0
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module not supported.
Attempting to use CommonJS require() on an ESM-only package.
fix
Use `import remarkLintNoHeadingPunctuation from 'remark-lint-no-heading-punctuation'` instead of `require(...)`.
Unexpected character `:` at end of heading, remove it
Heading ends with a punctuation mark that is disallowed by the rule's default configuration.
fix
Remove the trailing punctuation from the heading, or configure the rule to allow specific characters.
TypeError: remarkLintNoHeadingPunctuation is not a function
The default export is imported incorrectly (e.g., using named import instead of default).
fix
Use `import remarkLintNoHeadingPunctuation from 'remark-lint-no-heading-punctuation'` (default import).
Upgrade
Version history
4.0.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
remark-lint-no-heading-punctuation — npm install remark-lint-no-heading-punctuation · libregistry