hast-util-heading is a highly specialized utility within the unified ecosystem, designed to programmatically check if a given HAST (Hypertext Abstract Syntax Tree) node represents a heading element (h1-h6, hgroup). The current stable version is 3.0.0. As part of the syntax-tree collective, it adheres to a release cadence that maintains compatibility with currently supported Node.js versions, typically dropping support for unmaintained Node.js versions with new major releases. Its key differentiator is its singular, focused purpose: providing a reliable, performant boolean check for heading elements, which is particularly useful in linting tools, accessibility checkers, or content transformers operating on HTML syntax trees. It is built for ESM-first environments and provides full TypeScript type definitions.
npm install hast-util-headingVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `heading` function to check if a HAST node is a heading element.
Upgrade your Node.js environment to version 16 or newer. Alternatively, if upgrading Node.js is not possible, downgrade this package to `hast-util-heading@^2`.
Migrate your project to use ES modules (`import`). If you must use CommonJS, use dynamic `import()` and ensure your bundler (if any) is configured for ESM. For older environments or CJS-only projects, use `hast-util-heading@^1`.
Run `npm install @types/hast@latest` to ensure compatibility with `hast-util-heading@3`.
Always use named import syntax: `import { heading } from 'hast-util-heading';`.Change your import statement from `const heading = require('hast-util-heading');` to `import { heading } from 'hast-util-heading';` and ensure your environment supports ESM (e.g., set `"type": "module"` in `package.json` or use `.mjs` files).Correct the import statement to use named import syntax: `import { heading } from 'hast-util-heading';`.Ensure your Node.js version is 16 or higher. If it is, clear your `node_modules` and `package-lock.json` (`rm -rf node_modules package-lock.json && npm install`) to resolve potential module resolution issues. Alternatively, if you cannot upgrade Node.js, install an older compatible version like `hast-util-heading@^2` or `hast-util-heading@^1`.
No dependency data recorded yet.