hast-util-from-html-isomorphic is a utility package for the hast ecosystem that efficiently converts HTML strings into a hast (HTML Abstract Syntax Tree) tree. Designed for isomorphic applications, it intelligently uses hast-util-from-dom in browser environments, leveraging native DOM parsing APIs for a significantly smaller bundle size, and falls back to hast-util-from-html in Node.js. This approach prioritizes minimal client-side footprint, making it ideal for web components, static site generators, or libraries that need to process HTML both server-side and client-side without a large parser overhead. A key characteristic is that it does not preserve positional information (line, column, offset) from the original HTML string, a deliberate trade-off for its performance and size benefits. The current stable version is 2.0.0, which updated its @types/hast dependency. This package is part of the syntax-tree unified ecosystem and generally sees updates as underlying dependencies or major features warrant, rather than on a strict time-based cadence.
npm install hast-util-from-html-isomorphicVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing HTML strings into HAST trees, showing the difference between parsing as a document (default) and as a fragment, highlighting the common usage patterns.
Run `npm install hast@latest @types/hast@latest` or `yarn add hast@latest @types/hast@latest` in your project.
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) or use dynamic `import()` within CommonJS files. Always use `import ... from 'hast-util-from-html-isomorphic'`.
If positional information is critical for your use case (e.g., linting, detailed error reporting), use `hast-util-from-html` instead, which provides this data but has a larger bundle size.
Change `const { fromHtmlIsomorphic } = require(...)` to `import { fromHtmlIsomorphic } from '...'`. Ensure your Node.js environment and project configuration support ESM.Update your project's `hast` and `@types/hast` packages to their latest compatible versions. For example, `npm update hast @types/hast`.
This is expected behavior. If you require positional information, you must use `hast-util-from-html` instead of `hast-util-from-html-isomorphic`.
No dependency data recorded yet.