2.0.3 • Published 1 year ago

jsx-html-converter v2.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

jsx-html-converter

This npm package provides a function that can be used to convert an HTML string to valid JSX by closing any optional tags that are valid in HTML. This can be useful when working with HTML content in a React application.

Installation

You can install this package using npm:

npm i jsx-html-converter

Usage

To use the closeOptionalTags function, import it into your JavaScript file:

const closeOptionalTags = require("jsx-html-converter"); You can then call the function with an HTML string as the argument:

const html = <p>Hello, world!</p> const jsx = closeOptionalTags(html); console.log(jsx); // Output: <p>Hello, world!</p>

The function will return the HTML string converted to valid JSX, with any optional tags closed:

const html = <img src='example.jpg'>; const jsx = closeOptionalTags(html); console.log(jsx); // Output: <img src='example.jpg'/>

License

This package is licensed under the MIT license.

Repo

https://github.com/tungolra/html-jsx-converter

2.0.3

1 year ago

2.0.2

1 year ago

2.0.1

1 year ago

2.0.0

1 year ago

1.0.0

1 year ago