Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/wadackel/htmltojsx
:warning: [DEPRECATED] HTML to JSX converter. Forked from reactjs/react-magic. Support for SVG attributes.
https://github.com/wadackel/htmltojsx
converter html jsx react reactjs
Last synced: about 2 months ago
JSON representation
:warning: [DEPRECATED] HTML to JSX converter. Forked from reactjs/react-magic. Support for SVG attributes.
- Host: GitHub
- URL: https://github.com/wadackel/htmltojsx
- Owner: wadackel
- License: mit
- Created: 2017-07-05T05:39:23.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-09-11T05:35:51.000Z (over 7 years ago)
- Last Synced: 2024-10-11T20:17:54.681Z (3 months ago)
- Topics: converter, html, jsx, react, reactjs
- Language: JavaScript
- Homepage:
- Size: 35.2 KB
- Stars: 8
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# htmltojsx
[PR136]: https://github.com/reactjs/react-magic/pull/136
[PR138]: https://github.com/reactjs/react-magic/pull/138[![Build Status](http://img.shields.io/travis/tsuyoshiwada/htmltojsx.svg?style=flat-square)](https://travis-ci.org/tsuyoshiwada/htmltojsx)
[![npm (scoped)](https://img.shields.io/npm/v/@tsuyoshiwada/htmltojsx.svg?style=flat-square)](https://www.npmjs.com/package/@tsuyoshiwada/htmltojsx)> :warning: **Deprecated** :warning:
> Patches [#136][PR136] and [#138][PR138] have been merged into the original. Therefore, this package is no longer needed: tada:---
> HTML to JSX converter. Forked from [reactjs/react-magic](https://github.com/reactjs/react-magic). Support for SVG attributes.
## Table of Contents
* [What is different from the original?](#what-is-different-from-the-original)
* [Install](#install)
* [Usage](#usage)
* [Contribute](#contribute)
* [License](#license)## What is different from the original?
The support of SVG is different from the original.
You can convert attributes and tag names owned by SVG.The conversion result differs as follows.
**Actual:**
```html
```
**htmltojsx (original):**
```HTML
```
* `` is in lowercase letters. (Should be camel case)
* `fill-opacity` is in kebab-case letters. (Should be camel case)**@tsuyoshiwada/htmltojsx (this package):**
```javascript
```
## Install
```bash
$ npm install --save @tsuyoshiwada/htmltojsx
```## Usage
```javascript
const HTMLtoJSX = require('@tsuyoshiwada/htmltojsx');// Default options
const converter = new HTMLtoJSX({
createClass: false, // default `true`
indent: ' ', // default `' '`
});const html = `
`;const result = converter.convert(html);
console.log(result);
/*
Support SVG attributes
*/
```## Contribute
1. Fork it!
1. Create your feature branch: git checkout -b my-new-feature
1. Commit your changes: git commit -am 'Add some feature'
1. Push to the branch: git push origin my-new-feature
1. Submit a pull request :DBugs, feature requests and comments are more than welcome in the [issues](https://github.com/tsuyoshiwada/htmltojsx/issues).
## License
[MIT © tsuyoshiwada](./LICENSE)