Here is a handy utility to be coupled with the text2html utility distributed with HTML::FromText.
use HTML::TreeBuilder;
use HTML::PrettyPrinter;
my $html = HTML::TreeBuilder->new_from_content(do{local $/;<>})->guts;
my %opts = map {$_, 1} qw[quote_attr allow_forced_nl];
print @{ HTML::PrettyPrinter->new(%opts)->format($html) }; Posted from caseywest.com, comment here.