remark-lint-blockquote-indentation

raw JSON →
4.0.1 verified Fri May 01 auth: no javascript

A remark-lint rule that warns when block quotes are indented too much or too little, checking the `>` marker and the spaces before content. The `remark-lint` ecosystem provides over 100 rules for linting Markdown. Current stable version 4.0.1 (ESM-only, requires Node.js 16+). Part of the unified/remark ecosystem, maintained by the remark team. Key differentiator: deeply integrated with remark-lint presets like `remark-preset-lint-consistent` and `remark-preset-lint-markdown-style-guide`.

error Cannot find module 'remark-lint-blockquote-indentation'
cause Package not installed or ESM-only file required with `require()`.
fix
Run npm install remark-lint-blockquote-indentation and use import syntax (Node 16+).
error Error: [object Object] is not a plugin
cause Passing the import incorrectly (e.g., destructuring default export).
fix
Use default import: import remarkLintBlockquoteIndentation from 'remark-lint-blockquote-indentation'.
error TypeError: plugin is not a function
cause Using the plugin without `remark-lint` being set up first.
fix
Ensure you call .use(remarkLint) before .use(remarkLintBlockquoteIndentation) in the unified pipeline.
breaking Package is ESM-only since v4. Required Node.js 16+.
fix Use `import` syntax instead of `require()`, or switch to v3.x if you need CommonJS.
gotcha Options type is `number | 'consistent'`. Setting a number like `2` means exactly that many spaces after `>`. `'consistent'` detects the first blockquote's indent and warns on deviations.
fix Ensure you pass either a number or the string 'consistent' (not a boolean or other string).
gotcha The rule does **not** check the number of `>` markers themselves (nested blockquotes). It only checks whitespace after the *last* `>` marker.
fix Understand that the rule only validates spacing after the final `>` marker, not the nesting depth.
deprecated The `remark-lint` preset packages may be deprecated or have different default options. Check preset documentation.
fix Consult preset docs for recommended options; this rule's preset options are noted in the README.
npm install remark-lint-blockquote-indentation
yarn add remark-lint-blockquote-indentation
pnpm add remark-lint-blockquote-indentation

Shows how to apply the rule with a specific indentation option (2 spaces) and report lint warnings.

import remarkLint from 'remark-lint'
import remarkLintBlockquoteIndentation from 'remark-lint-blockquote-indentation'
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(remarkLintBlockquoteIndentation, 2) // enforce 2 spaces after `>`
  .use(remarkStringify)
  .process(file)

console.error(reporter(file))