html
HTML pretty printer CLI utility (based on jsbeautifier)
Last updated 4 years ago by maxogden .
BSD · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install html 
SYNC missed versions from official npm registry.

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)

  npm install html

Usage (command line)

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

returns:

  <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

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

Before pretty printing

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

Upgrading

grab the newest beautify-html.js from js-beautifier and drop it into lib/ as html.js. then add the following code to the bottom of html.js:

  module.exports = { prettyPrint: style_html }

BSD LICENSE

Current Tags

  • 1.0.0                                ...           latest (4 years ago)

10 Versions

  • 1.0.0                                ...           4 years ago
  • 0.0.10                                ...           5 years ago
  • 0.0.9                                ...           5 years ago
  • 0.0.7                                ...           8 years ago
  • 0.0.6                                ...           8 years ago
  • 0.0.5                                ...           8 years ago
  • 0.0.4                                ...           8 years ago
  • 0.0.3                                ...           8 years ago
  • 0.0.2                                ...           8 years ago
  • 0.0.1                                ...           9 years ago
Maintainers (1)
Downloads
Today 562
This Week 3,438
This Month 2,161
Last Day 724
Last Week 2,968
Last Month 15,582
Dependencies (1)
Dev Dependencies (0)
None
Dependents (193)

Copyright 2014 - 2016 © taobao.org |