# html

> HTML pretty printer CLI utility (based on jsbeautifier)

Latest version **1.0.0** (published 2016-08-09) · BSD license · 0 weekly downloads

## Install

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

Provides the command `html`.

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2016-08-09 |
| First published | 2011-09-10 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | separate (@types/html) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 76 |
| Author | Max Ogden |
| Maintainers | maxogden |
| Keywords | html, tabifier, beautifier, prettyprinter, prettifier, pretty, command, shell |

## Links

- npm: https://www.npmjs.com/package/html
- Repository: https://github.com/maxogden/commonjs-html-prettyprinter
- Issues: https://github.com/maxogden/commonjs-html-prettyprinter/issues
- npm.io page: https://npm.io/package/html

## Dependencies (1)

- [concat-stream](https://npm.io/package/concat-stream.md) ^1.4.7

## Alternatives

- [@tsparticles/shape-image](https://npm.io/package/@tsparticles/shape-image.md) — 303.7K weekly downloads
- [@tsparticles/shape-line](https://npm.io/package/@tsparticles/shape-line.md) — 233.7K weekly downloads
- [stringify-attributes](https://npm.io/package/stringify-attributes.md) — 58.6K weekly downloads
- [mobile-drag-drop](https://npm.io/package/mobile-drag-drop.md) — 46.3K weekly downloads
- [@comunica/actor-rdf-parse-html](https://npm.io/package/@comunica/actor-rdf-parse-html.md) — 29.2K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2016-08-09
- 0.0.10 — 2015-04-13
- 0.0.9 — 2015-03-17
- 0.0.7 — 2012-11-27
- 0.0.6 — 2012-10-08
- 0.0.5 — 2012-10-08
- 0.0.4 — 2012-10-08
- 0.0.3 — 2012-09-04
- 0.0.2 — 2012-07-12
- 0.0.1 — 2011-09-10

## README

# html prettyprinter

A node port of beautify-html.js by Nochum Sossonko which is based on jsbeautifier by Einar Lielmanis

## Installation

### from npm (node package manager)
``` bash
  npm install html
```

## Usage (command line)

```
  echo "<h2><strong><a href="http://awesome.com">AwesomeCom</a></strong><span>is awesome</span></h2>" | html
```

returns:
  
``` html  
  <h2>
      <strong>
          <a href=http://awesome.com>AwesomeCom</a>
      </strong>
      <span>
          is awesome
      </span>
  </h2>
````

`html foo.html` will write the prettified version to `stdout`.

`html *.html` will *update in place* all matching html files with their prettified versions.

## Advanced usage

I find myself constantly using the 'Copy as HTML' feature of the Chrome Inspector:

![Copy as HTML](https://github.com/maxogden/commonjs-html-prettyprinter/raw/master/img/copyashtml.png)

The downside is that that usually the HTML that gets copied is pretty ugly:

![Before pretty printing](https://github.com/maxogden/commonjs-html-prettyprinter/raw/master/img/before.png)

On OS X you can use `pbpaste` and `pbcopy` to stream your clipboard in and out of unix pipes. With the ugly HTML still in your clipboard run this command:

`pbpaste | html | pbcopy`

Now when you paste your clipboard into an editor you will get nice, pretty printed HTML:

![After pretty printing](https://github.com/maxogden/commonjs-html-prettyprinter/raw/master/img/after.png)

## Upgrading

grab the newest `beautify-html.js` from [js-beautifier](https://github.com/einars/js-beautify) and drop it into `lib/` as `html.js`. then add the following code to the bottom of `html.js`:

```javascript
  module.exports = { prettyPrint: style_html }
```

BSD LICENSE

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