# html-to-jsonml

> parse5-based library for converting JsonML to HTML.

Latest version **0.0.6** (published 2019-05-23) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install html-to-jsonml
pnpm add html-to-jsonml
yarn add html-to-jsonml
bun add html-to-jsonml
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2019-05-23 |
| First published | 2018-01-18 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Kristian Antonsen |
| Maintainers | kbadk |
| Keywords | jsonml, json, html, parse5, webstrates |

## Links

- npm: https://www.npmjs.com/package/html-to-jsonml
- Repository: https://github.com/Webstrates/html-to-jsonml
- Homepage: https://github.com/Webstrates/html-to-jsonml#readme
- Issues: https://github.com/Webstrates/html-to-jsonml/issues
- npm.io page: https://npm.io/package/html-to-jsonml

## Dependencies (1)

- [parse5](https://npm.io/package/parse5.md) ^4.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 0.0.6 (latest) — 2019-05-23
- 0.0.5 — 2018-11-09
- 0.0.4 — 2018-08-19
- 0.0.3 — 2018-08-15
- 0.0.2 — 2018-01-18
- 0.0.1 — 2018-01-18

## README

# html-to-jsonml

A simple [`parse5`](https://github.com/inikulin/parse5)-based library for converting HTML text to
[JsonML](http://www.jsonml.org/). Developed for [Webstrates](https://webstrates.net/), but can be
used for anything JsonML-related.

This replaces the [`htmlparser2`](https://github.com/fb55/htmlparser2)-based
[`jsonml-parse`](https://github.com/CMTegner/jsonml-parse) module we previously used, because  of
its issues parsing `<script>` tags with `<`. For instance, `htmlparser2` would turn

```html
<script>var x, y, z = x < y;</script>
```

Into

```json
["script","var x, y, z = x ","< y;"]
```

Whereas this library gives you

```json
["script",{},"var x, y, z = x < y;"]
```

With more complicated script code, this gets even worse with `jsonml-parse`, resulting in odd and
complicated objects, rather than plain text as it should be.

To be fair to `jsonml-parse`, this is not an issue with the module itself, but with the the
underlying `htmlparser2`.

Additionally, it's worth noting that `html-to-jsonml` (at the time of writing) takes up 459 KB: 29
KB of which is this library itself, and 430 KB on parse5. In comparison, `jsonml-parse` uses a
total 2.6 MB.

Very brief and initial testing shows that `jsonmlParse` appears to be slightly faster than
`html-to-jsonml`, though.

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