{"id":26219,"library":"remark-lint-heading-style","title":"remark-lint-heading-style","description":"A remark-lint rule that warns when Markdown headings violate a specified or consistent style (ATX, ATX-closed, or setext). Version 4.0.1 is the latest stable release, part of the remark-lint ecosystem. It is ESM-only (Node 16+). Unlike alternatives like markdownlint, it integrates seamlessly with unified and remark, allowing programmatic linting and fixes. It supports automatic style detection (consistent) and explicit configuration. The package ships TypeScript types and is commonly used in presets like remark-preset-lint-consistent and remark-preset-lint-markdown-style-guide.","status":"active","version":"4.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","atx","heading","lint","remark","remark-lint","remark-lint-rule","rule","setext","typescript"],"install":[{"cmd":"npm install remark-lint-heading-style","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-heading-style","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-heading-style","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Core linting infrastructure required for rule to operate","package":"remark-lint","optional":false},{"reason":"Unified ecosystem dependency for processing pipelines","package":"unified","optional":false}],"imports":[{"note":"Default export only; named export will fail. ESM-only since v4.","wrong":"import { remarkLintHeadingStyle } from 'remark-lint-heading-style'","symbol":"remarkLintHeadingStyle","correct":"import remarkLintHeadingStyle from 'remark-lint-heading-style'"},{"note":"TypeScript type, not a runtime value; use import type.","wrong":"import { Options } from 'remark-lint-heading-style'","symbol":"Options","correct":"import type { Options } from 'remark-lint-heading-style'"},{"note":"TypeScript type; valid values: 'atx', 'atx-closed', 'setext'.","wrong":"","symbol":"Style","correct":"import type { Style } from 'remark-lint-heading-style'"}],"quickstart":{"code":"import { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport remarkLint from 'remark-lint'\nimport remarkLintHeadingStyle from 'remark-lint-heading-style'\nimport { read } from 'to-vfile'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await read('example.md')\n\nawait unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintHeadingStyle, 'atx') // or 'consistent' (default)\n  .use(remarkStringify)\n  .process(file)\n\nconsole.error(reporter(file))","lang":"typescript","description":"Demonstrates unified pipeline to parse, lint headings for ATX style, and output warnings using vfile-reporter."},"warnings":[{"fix":"Switch to ES modules: use 'import' instead of 'require()'. Set type: 'module' in package.json or use .mjs extension.","message":"ESM-only since v4; requires Node 16+ and cannot be used with CommonJS require().","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use explicit style like 'atx' or 'setext' to be safe.","message":"The older style option 'consistent' is deprecated in favor of explicit style or 'consistent' string? Actually, 'consistent' is still valid but may change in future major versions.","severity":"deprecated","affected_versions":">=4.0.0"},{"fix":"Ensure the markdown structure is flat or test edge cases; consider using remark-lint with other plugins.","message":"The rule only checks top-level headings; nested headings inside blockquotes or list items may not be linted consistently across all versions.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use dynamic import() or switch to ES modules. Set 'type': 'module' in package.json.","cause":"Using CommonJS require() on an ESM-only package.","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Use: import remarkLintHeadingStyle from 'remark-lint-heading-style'","cause":"Named import instead of default import.","error":"TypeError: remarkLintHeadingStyle is not a function"},{"fix":"Install remark-lint alongside: npm install remark-lint remark-lint-heading-style","cause":"Missing peer dependency remark-lint.","error":"Cannot find module 'remark-lint'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}