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.

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
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'.
npm install remark-lint-no-hr-after-heading
yarn add remark-lint-no-hr-after-heading
pnpm add remark-lint-no-hr-after-heading

Demonstrates how to use remark-lint-no-hr-after-heading with remark, including lint and reporter.

// 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