remark-lint-no-hr-after-heading
raw JSON → 1.0.0 verified Fri May 01 auth: no javascript
A remark-lint rule that warns when a horizontal rule (thematic break) appears immediately after a heading. This package is version 1.0.0, released as a stable linting rule for the remark ecosystem. It helps enforce stylistic consistency by discouraging the use of `---` as a heading border. Unlike general heading styles, this rule specifically targets thematic breaks placed after headings. The rule is part of the remark-lint plugin collection and integrates seamlessly with remark's CLI, API, and configuration files.
Common errors
error Error: Cannot find module 'remark-lint-no-hr-after-heading' ↓
cause Package not installed
fix
npm install remark-lint-no-hr-after-heading
error TypeError: remark().use(...) is not a function ↓
cause Forgetting to call .use() with lint first
fix
Ensure you call .use(lint) before .use(noHrAfterHeading)
error Warning: Ignored unknown rule: no-hr-after-heading ↓
cause Using the rule without the remark-lint plugin
fix
Add remark-lint to your plugins list and use it before this rule
Warnings
gotcha The package name is 'remark-lint-no-hr-after-heading', but README examples show incorrect install names like 'remark-lint-no-heading-indent' and 'lint-no-hr-after-indent'. Ensure you use the correct package name. ↓
fix Install the correct package: npm install remark-lint-no-hr-after-heading
gotcha This rule must be used together with the 'remark-lint' base plugin. Using it alone will have no effect. ↓
fix Add remark-lint as a dependency and use it before this rule: .use(lint).use(noHrAfterHeading)
gotcha The module uses CommonJS exports and may not have ESM compatibility. Using dynamic import may require special handling in ESM environments. ↓
fix Use require() or if using ESM, use createRequire from 'module'.
Install
npm install remark-lint-no-hr-after-heading yarn add remark-lint-no-hr-after-heading pnpm add remark-lint-no-hr-after-heading Imports
- default
const remarkLintNoHrAfterHeading = require('remark-lint-no-hr-after-heading') - default wrong
import { remarkLintNoHrAfterHeading } from 'remark-lint-no-hr-after-heading'correctimport remarkLintNoHrAfterHeading from 'remark-lint-no-hr-after-heading' - plugin wrong
.use(require('remark-lint-no-hr-after-heading').default)correct.use(require('remark-lint-no-hr-after-heading'))
Quickstart
// Example using remark with lint and this rule
const remark = require('remark')
const lint = require('remark-lint')
const noHrAfterHeading = require('remark-lint-no-hr-after-heading')
const report = require('vfile-reporter')
remark()
.use(lint)
.use(noHrAfterHeading)
.process('# Hello World\n---', (err, file) => {
console.error(report(err || file))
})
// Output: warning: Don’t use a horizontal line after a heading