Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

html

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html

HTML pretty printer.

  • 0.0.5
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

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

Building

To rebuild the html module to use the latest version of js-beautifier, see the following instructions:

  • clone this repo: git clone git://github.com/maxogden/commonjs-html-prettyprinter.git
  • install dev dependencies: npm install
  • run the build: npm run-script build

At this point, the lib/html.js file should have been updated with the latest copy of the source from js-beautifier

Keywords

FAQs

Package last updated on 08 Oct 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc