Skip to content

hoosteeno/metalsmith-html-tidy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published