mdast-util-heading-style is a focused utility designed to determine the style of a heading within an `mdast` (Markdown Abstract Syntax Tree) node. It identifies if a heading was authored using ATX (hashes, e.g., `## Heading`), ATX-closed (e.g., `## Heading ##`), or Setext (underline, e.g., `Heading\n===`) Markdown syntax. The package is currently at version 3.0.0 and operates within the broader `unified` ecosystem, often leveraged by linting tools like `remark-lint`. Its release cadence is tied to Node.js LTS versions, with major releases typically dropping support for unmaintained Node.js versions. A key differentiator is its precise, narrow scope: providing just the heading style information, rather than modifying or transforming the AST, making it a reliable building block for more complex Markdown processing pipelines. It is an ES module (ESM) only.
npm install mdast-util-heading-styleVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing various Markdown heading styles into an `mdast` AST and then using `headingStyle` to determine their type, including how to handle `undefined` results and the `relative` style option.
Refactor your project to use ES Modules (`import` statements). Ensure your `package.json` includes `"type": "module"` or use `.mjs` file extensions for your module files.
Upgrade your Node.js runtime environment to version 16 or a newer LTS release.
Update your code to check for `undefined` instead of `null` when evaluating the return value of `headingStyle`.
Ensure all imports refer to the main package entry point (e.g., `import { headingStyle } from 'mdast-util-heading-style'`) and avoid attempting to import from internal or private file paths.Migrate your code to use `import` statements (ES Modules). This may involve setting `"type": "module"` in your `package.json` or using `.mjs` file extensions.
Use ES Module import syntax: `import { headingStyle } from 'mdast-util-heading-style';`.Import the type using `import type { Style } from 'mdast-util-heading-style';` in your TypeScript files.No dependency data recorded yet.