HTML cleaner and beautifier
Do you have crappy HTML? I do!
Currently we have these articles available: The History of Foo An informative piece of information. A Horse Walked Into a Bar The bartender said "Why the long face?"
Just look at those blank lines and random line breaks, trailing spaces, mixed tabs, deprecated tags - it's outrageous!
Let's clean it up...
$ npm install clean-html
var cleaner = fs = file = processargv2; fs;
Sanity restored!
Currently we have these articles available: The History of Foo An informative piece of information. A Horse Walked Into a Bar The bartender said "Why the long face?"
Options
attr-to-remove
Attributes to remove from markup.
Type: Array
Default: ['align', 'valign', 'bgcolor', 'color', 'width', 'height', 'border', 'cellpadding', 'cellspacing']
block-tags
Block level element tags. Line breaks are added before and after, and nested content is indented. Note: this option has no effect unless pretty print is enabled.
Type: Array
Default: ['div', 'p', 'table', 'tr', 'td', 'blockquote', 'hr']
empty-tags
Empty element tags. Trailing slashes are removed.
Type: Array
Default: ['br', 'hr', 'img']
encoding
Using this option to specify the encoding of the input file will ensure its contents are properly converted to utf-8.
Type: String
Default: utf-8
pretty
Pretty prints the output by adding line breaks and indentation.
Type: Boolean
Default: true
remove-comments
Removes comments.
Type: Boolean
Default: false
tags-to-remove
Tags to remove from markup.
Type: Array
Default: ['font']
Adding values to option lists
These options are added for your convenience.
add-attr-to-remove
Additional attributes to remove from markup.
Type: Array
Default: null
add-block-tags
Additional block level element tags.
Type: Array
Default: null
add-empty-tags
Additional empty element tags.
Type; Array
Default: null
add-tags-to-remove
Additional tags to remove from markup.
Type; Array
Default: null