# vdom-to-html

> Turn virtual-dom nodes into HTML

Latest version **2.3.1** (published 2017-01-22) · MIT license · 0 weekly downloads

## Install

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

## 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 | 2.3.1 |
| Published | 2017-01-22 |
| First published | 2014-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 138 |
| Author | Nathan Tran |
| Maintainers | nthtran |

## Links

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

## Dependencies (3)

- [xtend](https://npm.io/package/xtend.md) ^4.0.0
- [param-case](https://npm.io/package/param-case.md) ^1.0.1
- [escape-html](https://npm.io/package/escape-html.md) ^1.0.1

## Recent versions

- 2.3.1 (latest) — 2017-01-22
- 2.3.0 — 2016-06-20
- 2.2.0 — 2015-11-07
- 2.1.1 — 2015-06-01
- 2.1.0 — 2015-05-15
- 2.0.0 — 2015-03-25
- 1.3.1 — 2015-03-11
- 1.3.0 — 2015-03-06
- 1.2.5 — 2015-02-21
- 1.2.4 — 2015-02-15
- 1.2.3 — 2015-01-14
- 1.2.2 — 2015-01-08
- 1.2.1 — 2015-01-07
- 1.2.0 — 2015-01-07
- 1.1.0 — 2014-12-21
- … 3 more at https://npm.io/package/vdom-to-html/versions

## README

# vdom-to-html

[![NPM version][npm-image]][npm-url]
[![Github release][github-image]][github-url]
[![Build status][travis-image]][travis-url]
[![Test coverage][coveralls-image]][coveralls-url]
[![Dependency Status][david-image]][david-url]
[![License][license-image]][license-url]

Turn [virtual-dom](https://github.com/Matt-Esch/virtual-dom/) nodes into HTML

## Installation

```sh
npm install --save vdom-to-html
```

## Usage

```js
var VNode = require('virtual-dom/vnode/vnode');
var toHTML = require('vdom-to-html');

toHTML(new VNode('input', { className: 'name', type: 'text' }));
// => '<input class="name" type="text">'
```

### Special case for Widgets

>Widgets are used to take control of the patching process, allowing the user to create stateful components, control sub-tree rendering, and hook into element removal.
[Documentation is available here](https://github.com/Matt-Esch/virtual-dom/blob/master/docs/widget.md).

Widgets are given an opportunity to provide a vdom representation through an optional `render` method. If the `render` method is not found an empty string will be used instead.

```js
var Widget = function(text) {
  this.text = text;
}
Widget.prototype.type = 'Widget';
// provide a vdom representation of the widget
Widget.prototype.render = function() {
  return new VNode('span', null, [new VText(this.text)]);
};
// other widget prototype methods would be implemented

toHTML(new Widget('hello'));
// => '<span>hello</span>'
```

[npm-image]: https://img.shields.io/npm/v/vdom-to-html.svg?style=flat-square
[npm-url]: https://npmjs.org/package/vdom-to-html
[github-image]: http://img.shields.io/github/release/nthtran/vdom-to-html.svg?style=flat-square
[github-url]: https://github.com/nthtran/vdom-to-html/releases
[travis-image]: https://img.shields.io/travis/nthtran/vdom-to-html.svg?style=flat-square
[travis-url]: https://travis-ci.org/nthtran/vdom-to-html
[coveralls-image]: https://img.shields.io/coveralls/nthtran/vdom-to-html.svg?style=flat-square
[coveralls-url]: https://coveralls.io/r/nthtran/vdom-to-html?branch=master
[david-image]: http://img.shields.io/david/nthtran/vdom-to-html.svg?style=flat-square
[david-url]: https://david-dm.org/nthtran/vdom-to-html
[license-image]: http://img.shields.io/npm/l/vdom-to-html.svg?style=flat-square
[license-url]: LICENSE

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