mdast-util-phrasing is a specialized utility within the unified (syntax-tree) ecosystem designed to accurately identify if a given mdast (Markdown Abstract Syntax Tree) node constitutes "phrasing content." This includes elements like text, emphasis, strong, links, and code spans, but notably excludes `html` nodes due to their dual nature as both phrasing and flow content. The package is currently stable at version 4.1.0 and is actively maintained by the unified collective, with major releases typically aligning with Node.js LTS version updates or significant architectural shifts, such as the transition to ESM-only in version 3.0.0. Its core functionality relies on `unist-util-is` for robust node testing, making it a foundational tool for building other mdast utilities that need to differentiate between inline and block-level content in Markdown.
npm install mdast-util-phrasingVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use the `phrasing` function to determine if an mdast node is phrasing content, showing examples for paragraph, strong, and HTML nodes.
Upgrade your Node.js environment to version 16 or later. If using a bundler, ensure it supports `export` maps.
Migrate your codebase to use ECMAScript Modules (ESM) `import` syntax. Ensure your `package.json` has `"type": "module"` or use `.mjs` file extensions.
Update `mdast-util-phrasing` and its peer dependencies (like `@types/mdast`) to the latest compatible versions to ensure correct type resolution.
If you need to classify `html` nodes, you will need to implement a custom check or use `hast-util-phrasing` for hast trees.
Change your import statement to `import { phrasing } from 'mdast-util-phrasing'` and ensure your environment supports ESM (e.g., `type: "module"` in `package.json` for Node.js).Use a named import: `import { phrasing } from 'mdast-util-phrasing';`Ensure your Node.js version is 16 or newer. Update `@types/mdast` and `mdast-util-phrasing` to their latest compatible versions.