h2x-core is the core compiler for h2x, an HTML-to-JSX transformer. It converts HTML strings into a JavaScript AST (JSX) via JSDOM, using a plugin system for extensibility. Version 1.1.1 is current, with releases every few months. Key differentiators: leverages JSDOM for robust parsing, supports state, and has a plugin architecture. It handles special SVG attributes and style attributes. Alternatives are typically SVGR or manual transformation.
npm install h2x-coreNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates how to compile HTML to JSX using a plugin.
Update code to use new API: node.originalNode, fromHtmlAttribute, fromHtmlElement.
Install and pass plugins: e.g., `compile(html, { plugins: [require('h2x-plugin-jsx')] })`.Ensure jsdom >=12 is installed.
Update to v1.x API (compile, transform, parse).
Run `npm install h2x-core` and ensure import path is correct: `import { compile } from 'h2x-core'`.Use named import: `import { compile } from 'h2x-core'`.Run `npm install jsdom@12`.