{"id":26257,"library":"remark-lint-no-heading-content-indent","title":"remark-lint-no-heading-content-indent","description":"A remark-lint rule that warns when there is extra whitespace between the opening hashes and the content of headings (ATX headings) in Markdown. It enforces a single space after the `#` markers and before the closing `#`s. This package is part of the remark-lint ecosystem, version 5.0.1, ESM-only, ships TypeScript type definitions. It has no dependencies and is recommended for ensuring consistent heading formatting. The rule is included in the `remark-preset-lint-recommended` preset.","status":"active","version":"5.0.1","language":"javascript","source_language":"en","source_url":"https://github.com/remarkjs/remark-lint#main","tags":["javascript","content","heading","indent","lint","remark","remark-lint","remark-lint-rule","rule","typescript"],"install":[{"cmd":"npm install remark-lint-no-heading-content-indent","lang":"bash","label":"npm"},{"cmd":"yarn add remark-lint-no-heading-content-indent","lang":"bash","label":"yarn"},{"cmd":"pnpm add remark-lint-no-heading-content-indent","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; CommonJS require is not supported. Use import syntax.","wrong":"const remarkLintNoHeadingContentIndent = require('remark-lint-no-heading-content-indent')","symbol":"remarkLintNoHeadingContentIndent","correct":"import remarkLintNoHeadingContentIndent from 'remark-lint-no-heading-content-indent'"},{"note":"Needed to create a processor. The unified package is a peer dependency.","wrong":"const unified = require('unified')","symbol":"unified","correct":"import { unified } from 'unified'"},{"note":"Parses Markdown into a syntax tree.","wrong":"","symbol":"remarkParse","correct":"import remarkParse from 'remark-parse'"},{"note":"Compiles the syntax tree back to Markdown.","wrong":"","symbol":"remarkStringify","correct":"import remarkStringify from 'remark-stringify'"}],"quickstart":{"code":"import { unified } from 'unified'\nimport remarkParse from 'remark-parse'\nimport remarkStringify from 'remark-stringify'\nimport remarkLint from 'remark-lint'\nimport remarkLintNoHeadingContentIndent from 'remark-lint-no-heading-content-indent'\nimport { reporter } from 'vfile-reporter'\n\nconst file = await unified()\n  .use(remarkParse)\n  .use(remarkLint)\n  .use(remarkLintNoHeadingContentIndent)\n  .use(remarkStringify)\n  .process('#  Bad heading\\n\\n## Good heading')\n\nconsole.error(reporter(file))\n// 1:4: Unexpected `2` spaces between hashes and content, expected `1` space, remove `1` space","lang":"typescript","description":"Shows how to set up the lint rule with unified, parse a Markdown string with an extra space after the hash, and report the linting error."},"warnings":[{"fix":"Replace `const x = require('remark-lint-no-heading-content-indent')` with `import x from 'remark-lint-no-heading-content-indent'`","message":"Version 4.0.0 and later require ESM imports. CommonJS `require()` will fail.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Use ATX headings if you want consistent indentation linting. Setext headings are ignored by design.","message":"The rule only checks ATX headings (starting with #) and does not affect setext headings (underlined with === or ---). Indented hash characters inside setext headings are not flagged.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Ensure headings are not indented with extra spaces. The rule expects exactly `# SPACE CONTENT` (or `# SPACE CONTENT SPACE #` for closed ATX).","message":"The rule expects exactly one space between hashes and content; leading whitespace before the hashes is also checked: extra spaces before the opening hashes count as indentation that may not match the expected single space after hashes.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to v5.0.1 to ensure compatibility with unified@11 and remark@15.","message":"Version 5.0.1 is the latest. No breaking changes since v4 but the package is part of remark-lint that regularly updates peer dependencies.","severity":"deprecated","affected_versions":"<=4.0.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Edit the heading to have exactly one space after the opening `#`(s) and exactly one space before any closing `#`(s). Example: `# Heading` not `#  Heading`.","cause":"Heading content has more than one space after the opening hashes or before the closing hashes.","error":"Unexpected `N` spaces between hashes and content, expected `1` space, remove `N-1` spaces"},{"fix":"Remove extra spaces before the closing `#`(s). Example: `## Heading ##` not `## Heading  ##`.","cause":"Closed ATX heading has more than one space before the closing hashes.","error":"Unexpected `N` spaces between content and hashes, expected `1` space, remove `N-1` spaces"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}