emplums / html2jsx

Convert HTML/SVG text to JSX functions

Home Page:https://xaviervia.github.io/html2jsx

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

html2jsx

Try it live

See also html2react-json

npm i -g html2jsx

html2jsx index.html
html2jsx Icon.svg
import html2jsx from 'html2jsx'

const html = `<h1 class="hello">Hello JSX</h1>`

console.log(html2jsx(html, {name: 'Example'}))

Note that the programmatic usage will only work in a browser environment. If you want to use it in Node, you will need to wrap it in jsdom. You can take a look at the command line tool implementation for an example of how to do this

Credits

License

The Unlicense

About

Convert HTML/SVG text to JSX functions

https://xaviervia.github.io/html2jsx

License:The Unlicense


Languages

Language:JavaScript 77.0%Language:HTML 18.7%Language:Makefile 4.0%Language:CSS 0.4%