# html2hyperscript

> Convert legacy HTML to Hyperscript (https://github.com/dominictarr/hyperscript)

Latest version **1.0.1** (published 2015-03-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install html2hyperscript
pnpm add html2hyperscript
yarn add html2hyperscript
bun add html2hyperscript
```

Provides the command `html2hyperscript`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2015-03-17 |
| First published | 2015-01-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 45 |
| Author | Nick Matantsev |
| Maintainers | unframework |

## Links

- npm: https://www.npmjs.com/package/html2hyperscript
- Repository: https://github.com/unframework/html2hyperscript
- Issues: https://github.com/unframework/html2hyperscript/issues
- npm.io page: https://npm.io/package/html2hyperscript

## Dependencies (1)

- [htmlparser2](https://npm.io/package/htmlparser2.md) ~3.8.2

## Recent versions

- 1.0.1 (latest) — 2015-03-17
- 0.1.1 — 2015-03-17
- 0.1.0 — 2015-01-23

## README

[![Build Status](https://travis-ci.org/unframework/html2hyperscript.svg?branch=master)](https://travis-ci.org/unframework/html2hyperscript)

# Convert Legacy HTML to Hyperscript

Automatically translate old HTML markup into the new Hyperscript markup embeddable directly inside your component Javascript code.

Use this for hand-converting legacy project source code (e.g. AngularJS templates): care is taken to preserve original whitespace and even comments. For dynamic serving and CI builds check out https://github.com/alexmingoia/jsx-transform instead.

```
npm install -g html2hyperscript
html2hyperscript legacy_markup_file.html > shiny_new_syntax.js
```

See Hyperscript library: https://github.com/dominictarr/hyperscript

Also useful for virtual DOM Hyperscript-like syntax: https://github.com/Matt-Esch/virtual-dom

HTML goes in:

```html
<table class="sample-html">
  <tr>
    <th>Pandas</th>
    <th>Kittens</th>
    <th>Hedgehogs</th>
  </tr>
  <tr>
    <td>foo</td>
    <td>bar</td>
    <td>baz</td>
  </tr>
  <tr>
    <td>32</td>
    <td>45</td>
    <td>83</td>
  </tr>
  <tr>
    <td>onomatopoeia</td>
    <td>schadenfreude</td>
    <td>antidisestablishmentarianism</td>
  </tr>
</table>
```

Hyperscript-like JS syntax comes out:

```js
h("table.sample-html", [
  h("tr", [
    h("th", [ "Pandas" ]),
    h("th", [ "Kittens" ]),
    h("th", [ "Hedgehogs" ])
  ]),
  h("tr", [
    h("td", [ "foo" ]),
    h("td", [ "bar" ]),
    h("td", [ "baz" ])
  ]),
  h("tr", [
    h("td", [ "32" ]),
    h("td", [ "45" ]),
    h("td", [ "83" ])
  ]),
  h("tr", [
    h("td", [ "onomatopoeia" ]),
    h("td", [ "schadenfreude" ]),
    h("td", [ "antidisestablishmentarianism" ])
  ])
])
```

## TODO

- some tests

---
_Source: https://npm.io/package/html2hyperscript · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
