remark-preset-lint-markdown-style-guide

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

Remark preset that configures remark-lint rules to enforce the Markdown Style Guide. Version 6.0.1 ships TypeScript types and is actively maintained as part of the remark-lint monorepo. It includes 30+ lint rules with sensible defaults like fenced code blocks, ATX headings, and hyphen unordered list markers. Unlike generic presets, this one maps directly to an existing style guide and supports overrides for space-sentence, wrap, header, list-marker, list-space, and code options. Release cadence is patch-level; breaking changes are rare and documented in changelogs.

error Cannot find module 'remark-preset-lint-markdown-style-guide'
cause Missing installation or wrong import path in a CommonJS project.
fix
npm install remark-preset-lint-markdown-style-guide and ensure your project is ESM or use dynamic import.
error TypeError: remarkPresetLintMarkdownStyleGuide is not a function
cause Using named import instead of default import.
fix
Change to: import remarkPresetLintMarkdownStyleGuide from 'remark-preset-lint-markdown-style-guide'
error Error: Cannot use import statement outside a module
cause Attempting to use ESM import in a CommonJS file.
fix
Set type: 'module' in package.json or rename file to .mjs.
error The option 'remark-lint-maximum-line-length' is not a boolean
cause Passing a boolean false to disable a rule, but the preset expects an object or array.
fix
Correct syntax: ['remark-lint-maximum-line-length', false] (array of two elements)
breaking v6.0.0 dropped CommonJS support. Package is now ESM-only.
fix Migrate to ESM or use dynamic import: const pkg = await import('remark-preset-lint-markdown-style-guide')
deprecated The option 'header:setext' uses a deprecated method; prefer ATX headings.
fix Override 'remark-lint-heading-style' option to 'setext' via preset configuration.
breaking v5.0.0 renamed the presets from 'remark-preset-lint-markdown-style-guide' to 'remark-preset-lint-markdown-style-guide' (no change) but removed support for Node < 12.
fix Update Node.js to version 12 or later.
gotcha The preset includes remark-lint automatically; adding it twice causes duplicate linting.
fix Do not include 'remark-lint' separately unless you need custom options.
gotcha Options like 'wrap:no', 'header:setext', etc. must be configured via overriding individual lint rules, not by passing options to the preset.
fix Follow the README's override patterns: e.g., use ['remark-lint-maximum-line-length', false] to disable line length.
npm install remark-preset-lint-markdown-style-guide
yarn add remark-preset-lint-markdown-style-guide
pnpm add remark-preset-lint-markdown-style-guide

Shows how to set up a unified pipeline with remark-lint and the markdown style guide preset, then lint a simple markdown string.

import { unified } from 'unified';
import remarkParse from 'remark-parse';
import remarkPresetLintMarkdownStyleGuide from 'remark-preset-lint-markdown-style-guide';
import remarkStringify from 'remark-stringify';
import remarkLint from 'remark-lint';

const processor = unified()
  .use(remarkParse)
  .use(remarkLint)
  .use(remarkPresetLintMarkdownStyleGuide)
  .use(remarkStringify);

const file = await processor.process('## Hello world');
console.log(file.messages); // lint warnings/errors