Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 400,000 packages pre-installed, including metalsmith-html-tidy with all npm packages installed. Try it out:

var metalsmithHtmlTidy = require("metalsmith-html-tidy")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

metalsmith-html-tidy v1.1.2

metalsmith wrapper around tidy-html5

metalsmith-html-tidy

A Metalsmith plugin that tidies HTML using tidy-html5, which is a JavaScript compilation of Tidy.

Installation

$ npm install [--save] metalsmith-html-tidy

Usage

const tidy = require('metalsmith-html-tidy');

metalsmith.use(tidy({
    pattern: '**/*html',
    tidyOptions {
      'indent-spaces': 4,
    }
}));
  • pattern is a multimatch pattern. Default is **/*.html (any html file anywhere).

  • tidyOptions include any of Tidy's countless options. Defaults are Tidy defaults plus...

    'indent': true,
    'indent-spaces': 2,
    'wrap': 0,
    'vertical-space': true,
    'quiet': true,
    'show-info': false,
    'show-warnings': false,
    

Demo

$ cd demo
$ npm install
$ node build
$ diff src/untidy.html build/untidy.html

Test

$ npm install
$ DEBUG=metalsmith-html-tidy npm test

License

MPL-2.0

Metadata

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free