htmltidy-options

Configuration options for htmltidy

npm install htmltidy-options
1 downloads in the last week
4 downloads in the last month

htmltidy-options

Configuration options for htmltidy

Install it on node from npm

npm install htmltidy-options

Usage

This module exports a single object whose properties are named configuration objects suitable for use with htmltidy. There are configuration objects for cleaning up pretty much any HTML, XHTML, or XML documents you come across.

Listing Available Configuration Objects Names

var htmltidyOptions = require('htmltidy-options');
console.log(Object.keys(htmltidyOptions));

Using With the htmltidy Module

var tidy            = require('htmltidy').tidy;
var htmltidyOptions = require('htmltidy-options');

tidy('<table><tr><td>badly formatted html</tr>', htmltidyOptions['Kastor tidy - HTML page UTF-8'], function(err, html) {
    console.log(html);
});

Configuration Options Included

Kastor's Custom Options

The page options will take markup fragments and convert them into pretty printed XHTML or HTML pages. The files should be in UTF-8 encoding or the output can get really weird.

  • Kastor tidy - XHTML page UTF-8
  • Kastor tidy - HTML page UTF-8

The fragment options will take markup fragments and output pretty printed XHTML or HTML fragments. This has the side effect of stripping out styles though. There are several options available for different input file encodings.

  • Kastor tidy - XHTML fragment UTF-8
  • Kastor tidy - XHTML fragment raw
  • Kastor tidy - XHTML fragment ascii
  • Kastor tidy - HTML fragment UTF-8
  • Kastor tidy - HTML fragment raw
  • Kastor tidy - HTML fragment ascii

The clean options will turn on tidy's clean option and use some sane defaults for quoting certain characters and scrubbing sloppy junk.

  • Kastor tidy - XHTML Clean page UTF-8
  • Kastor tidy - HTML Clean page UTF-8
  • Kastor tidy - XHTML Clean fragment UTF-8
  • Kastor tidy - HTML Clean fragment UTF-8

The XML reindent option takes an XML file in UTF-8 encoding and pretty prints it.

  • Kastor tidy - XML Reindent UTF-8

Tidy's Example Options

These options are useful to some people so I've included them here even though I only use them as examples when creating custom configuration settings. I'm saying they work but, they never quite did what I wanted.

  • TiDy clean Microsoft Word 2000 document
  • TiDy clean Document - quote
  • TiDy upgrade to CSS
  • TiDy convert to XML
  • Tidy convert to XHTML
  • Tidy Reindent XML

Contact Info

If you have any questions or want to help improve this module you can write me at matthewkastor@gmail.com or contact me through my Google + profile at https://plus.google.com/100898583798552211130

npm loves you