es-html-parser is a JavaScript/TypeScript library designed for parsing HTML content into an Abstract Syntax Tree (AST) that closely adheres to the ESTree specification. It also provides access to the raw token stream generated during parsing. Currently at version 0.3.1, this project originated as a fork of `hyntax` and is actively developed to align its AST output with ESTree standards, making it suitable for tooling that processes HTML with familiar JavaScript AST traversal patterns. While the release cadence is not explicitly defined, its 0.x version implies ongoing development and potential for breaking changes between minor versions. It differentiates itself by its ESTree-like AST structure, which can be advantageous for developers already familiar with JavaScript AST manipulation.
npm install es-html-parserVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates parsing a basic HTML string, including script tags, and accessing the resulting AST and tokens. It explicitly uses the `rawContentTags` option for common embedded content.
Always pin to exact versions (e.g., `"es-html-parser": "0.3.1"`) and review release notes carefully when upgrading to newer `0.x` versions.
Always provide an array of tag names to `rawContentTags` in the options if their content should be treated as raw text (e.g., `{ rawContentTags: ['script', 'style', 'custom-raw-tag'] }`).Ensure your project is configured for ESM by adding `"type": "module"` to your `package.json` or by using a bundler (like Webpack, Rollup, Parcel, or esbuild) that transpiles ESM to CJS if targeting older environments.
Verify that `import { parse } from 'es-html-parser';` is correctly used and that your bundler configuration is compatible with ESM modules. Ensure the package is installed correctly and not corrupted.No dependency data recorded yet.