# html-code-gen

> html-code-gen ========

Latest version **0.4.0** (published 2017-02-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install html-code-gen
pnpm add html-code-gen
yarn add html-code-gen
bun add html-code-gen
```

## 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.4.0 |
| Published | 2017-02-20 |
| First published | 2015-01-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | Hanxing Yang |
| Maintainers | nighca, ecomfe |

## Links

- npm: https://www.npmjs.com/package/html-code-gen
- Repository: https://github.com/ecomfe/html-code-gen
- Issues: https://github.com/ecomfe/html-code-gen/issues
- npm.io page: https://npm.io/package/html-code-gen

## Recent versions

- 0.4.0 (latest) — 2017-02-20
- 0.3.7 — 2015-11-09
- 0.3.6 — 2015-08-25
- 0.3.5 — 2015-08-25
- 0.3.4 — 2015-07-09
- 0.3.3 — 2015-06-04
- 0.3.2 — 2015-03-26
- 0.3.1 — 2015-03-26
- 0.3.0 — 2015-02-28
- 0.2.2 — 2015-02-09
- 0.2.1 — 2015-02-09
- 0.2.0 — 2015-01-27
- 0.1.0 — 2015-01-26
- 0.0.1 — 2015-01-13

## README

html-code-gen
========

[![Build Status](https://img.shields.io/travis/ecomfe/html-code-gen.svg?style=flat)](http://travis-ci.org/ecomfe/html-code-gen)
[![NPM version](https://img.shields.io/npm/v/html-code-gen.svg?style=flat)](https://www.npmjs.com/package/html-code-gen)
[![Coverage Status](https://img.shields.io/coveralls/ecomfe/html-code-gen.svg?style=flat)](https://coveralls.io/r/ecomfe/html-code-gen)
[![Dependencies](https://img.shields.io/david/ecomfe/html-code-gen.svg?style=flat)](https://david-dm.org/ecomfe/html-code-gen)
[![DevDependencies](https://img.shields.io/david/dev/ecomfe/html-code-gen.svg?style=flat)](https://david-dm.org/ecomfe/html-code-gen)


html-code-gen is a HTML-code generator. It generates HTML code with given dom(-like) object.

### Install

* nodejs

		npm install html-code-gen


	```javascript
	var htmlCodeGen = require('html-code-gen');
	```

* browser (UMD bundle generated by browserify)

	* global

		```html
		<script src="html-code-gen/browser/html-code-gen.min.js"></script>
		```

		```javascript
		var htmlCodeGen = window.htmlCodeGen;
		```

	* AMD

		```javascript
		var htmlCodeGen = require('html-code-gen');
		```

### Usage

```javascript
htmlCodeGen.print(dom, opt);
```

```javascript
htmlCodeGen.printAsync(dom, opt).then(
	output => console.log(output)
);
```

### Options

* `indent-size`: size of indent

	default: `4`

* `indent-char`: char of indent ( space / tab )

	default: `'space'`

* `max-char`: max char num in one line (TODO)

	default: `80`

* `no-format-tag`: tags whose content should not be formatted

	default: [`spec.tagTypeMap.structural`](./lib/spec.js#L26)

* `no-format`: no format

	default: `false`

* `inline-tag`: tags whose content should be inline

	default: [`spec.tagTypeMap.inline`](./lib/spec.js#L25)

* `formatter`: special formatters { tagName ( script / style ) : formater )

	default: `{}`

* `bool-attribute-value`: hide value of boolean attribute or not ( 'remove' / 'preserve' )

	default: `'remove'`

* `self-close`: should void tags close themeselves with "/" ( 'close' / 'no-close' )

	default: `'no-close'`

* `level`: current level

	default: `0`

### Development

* run test cases

		npm run test

* build for browser

		npm run browser

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