This package, `hast-util-is-conditional-comment`, is a specialized utility within the unified (specifically rehype) ecosystem designed to determine if a given `hast` (Hypertext Abstract Syntax Tree) node represents an HTML conditional comment. Conditional comments are a legacy feature primarily used by older versions of Internet Explorer (discontinued after IE 9) and are generally recommended for removal in modern web development. The current stable version is 3.0.1. As part of the `unified` collective, it adheres to a release cadence tied to major `unified` ecosystem updates, ensuring compatibility with other `hast` and `unist` utilities. Key differentiators include its tight integration with the `hast` AST format, its ESM-only distribution, and its strict compatibility with maintained Node.js versions (currently Node.js 16+). It does not perform transformations but provides a focused predicate function for identifying this specific, non-standard HTML comment type.
npm install hast-util-is-conditional-commentVerified import paths — ran on the pinned version, not inferred.
Demonstrates how to import and use `isConditionalComment` to programmatically check various `hast` comment nodes for Internet Explorer conditional comment syntax.
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json` or `.mjs` files) and upgrade Node.js to version 16 or newer. Replace `require()` calls with `import` statements.
Always use `rehype-sanitize` when processing untrusted HTML to prevent potential XSS attacks, especially if other plugins are transforming the tree.
If you need to identify other specific comment patterns, you will need to implement custom logic or use other `hast` utilities designed for broader comment analysis.
Change your import statement to `import { isConditionalComment } from 'hast-util-is-conditional-comment';` and ensure your environment supports ESM.The package has no default export. Always use named import syntax: `import { isConditionalComment } from 'hast-util-is-conditional-comment';`.No dependency data recorded yet.