hast-util-phrasing is a niche utility within the unified (remark/rehype) ecosystem, specifically designed to determine if a given HAST (Hypertext Abstract Syntax Tree) node represents 'phrasing content' according to HTML specifications. This classification is crucial for advanced HTML manipulation and validation scenarios. The package is currently at version 3.0.1, indicating active maintenance and regular, albeit minor, updates since its major release. It adheres to the unified collective's release cadence, typically aligning major versions with Node.js LTS support lifecycles. Its key differentiator is its precise adherence to HTML phrasing content rules, making it invaluable for tools that need to strictly adhere to HTML parsing and serialization standards, particularly in content transformation pipelines.
npm install hast-util-phrasingVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use the `phrasing` utility with various HAST node types to check if they qualify as phrasing content according to HTML specifications, illustrating different outcomes.
Ensure that the `value` argument passed to `phrasing` is always a valid HAST `Node`. Validate input before calling `phrasing` if external data is used.
Update your `@types/hast` package to the latest compatible version (e.g., `npm install @types/hast@latest`).
Upgrade your Node.js environment to version 16 or newer. For projects that must support older Node.js, pin the package to `hast-util-phrasing@^2`.
Always use the main entry point: `import { phrasing } from 'hast-util-phrasing'`. Do not rely on internal, non-exported paths.Refactor your imports to use ES module syntax: `import { phrasing } from 'hast-util-phrasing'`. Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json` or `.mjs` files).Use ESM import syntax: `import { phrasing } from 'hast-util-phrasing'`.Ensure the input to `phrasing` is always a valid HAST node object. Add checks like `if (value && typeof value === 'object' && 'type' in value) { phrasing(value); }` if inputs are untrusted.No dependency data recorded yet.