Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

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 = `


Support SVG attributes




`;

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 :D

Bugs, feature requests and comments are more than welcome in the [issues](https://github.com/tsuyoshiwada/htmltojsx/issues).

## License

[MIT © tsuyoshiwada](./LICENSE)