HTML::Tidy5(3pm)
π HTML::Tidy5(3pm) β bestie edition π
okay so this is the manual for HTML::Tidy5, filed under User Contributed Perl Documentation, and I am obsessed. It's an HTML checker and it's all yours. π
β¨ NAME β¨
HTML::Tidy5 β HTML validation in a Perl object. that's the whole vibe. π¦
π VERSION π
Version 1.06.
πΈ SYNOPSIS πΈ
use HTML::Tidy5;
my $tidy = HTML::Tidy5->new( {config_file => 'path/to/config'} );
$tidy->ignore( type => TIDY_WARNING, type => TIDY_INFO );
$tidy->parse( "foo.html", $contents_of_foo );
for my $message ( $tidy->messages ) {
print $message->as_string;
}
π DESCRIPTION π
HTML::Tidy5 is an HTML checker in a handy dandy object. no cap, that's the pitch. It's meant as a replacement for HTML::Lint, so if you're currently an HTML::Lint user looking to migrate, go look at the section "Converting from HTML::Lint" down below. π«Ά
π EXPORTS π
Message types TIDY_ERROR, TIDY_WARNING and TIDY_INFO.
Everything else is an object method. slay.
π METHODS π
π new()
Create an HTML::Tidy5 object.
my $tidy = HTML::Tidy5->new();
Optionally you can give a hashref of configuration parms.
my $tidy = HTML::Tidy5->new( {config_file => 'path/to/tidy.cfg'} );
This configuration file will be read and used when you clean or parse an HTML file.
You can also pass options directly to tidy.
my $tidy = HTML::Tidy5->new( {
output_xhtml => 1,
tidy_mark => 0,
} );
See "tidy -help-config" for the list of options supported by tidy.
The following options are not supported by HTML::Tidy5:
quiet
π¦ messages()
Returns the messages accumulated. that's it, bestie, it just hands them over.
π
clear_messages()
Clears the list of messages, in case you want to print and clear, print and clear. If you don't clear the messages, then each time you call parse() you'll be accumulating more in the list. lowkey a trap if you forget, so like... do not forget. π
π ignore( parm => value [, parm => value ] )
Specify types of messages to ignore. note that the ignore flags must be set before calling parse(). You can call ignore() as many times as necessary to set up all your restrictions; the options will stack up. cute right? π
type => TIDY_INFO|TIDY_WARNING|TIDY_ERRORβ Specifies the type of messages you want to ignore, either info or warnings or errors. If you wanted, you could call ignore on all three and get no messages at all.
$tidy->ignore( type => TIDY_WARNING );
text => qr/regex/text => [ qr/regex1/, qr/regex2/, ... ]β Checks the text of the message against the specified regex or regexes, and ignores the message if there's a match. The value for the text parm may be either a regex, or a reference to a list of regexes.
$tidy->ignore( text => qr/DOCTYPE/ );
$tidy->ignore( text => [ qr/unsupported/, qr/proprietary/i ] );
π§ parse( $filename, $str [, $str...] )
Parses a string, or list of strings, that make up a single HTML file.
The $filename parm is only used as an identifier for your use. The file is not actually read and opened. it's giving "decorative filename", iykyk. β¨
Returns true if all went OK, or false if there was some problem calling tidy, or parsing tidy's output.
πΈ clean( $str [, $str...] )
Cleans a string, or list of strings, that make up a single HTML file.
Returns the cleaned string as a single string. one string. just the one. π«Ά
β tidy_library_version()
Returns the version of the underling tidy library.
π οΈ INSTALLING TIDY π οΈ
HTML::Tidy5 requires that the html-tidy be installed on your system. You can probably obtain html-tidy through your distribution's package manager (make sure you install the development package with headers, bestie, don't skip that part π). You can also check the html-tidy home page is <http://www.html-tidy.org/>.
π CONVERTING FROM HTML::Lint π
HTML::Tidy5 is different from HTML::Lint in a number of crucial ways.
- It's not pure Perl β
HTML::Tidy5is mostly a happy wrapper around the html-tidy library. - The real work is done by someone else β Changes to tidy may come down the pipe that I don't have control over. That's the price we pay for having it do a darn good job.
- It's no longer bundled with its
Test::counterpart βHTML::Lintcame bundled withTest::HTML::Lint, butTest::HTML::Tidy5is a separate distribution. This saves the people who don't want theTest::framework from pulling it in, and all its prerequisite modules.
π BUGS & FEEDBACK π
Please report any bugs or feature requests at the issue tracker on github <http://github.com/petdance/html-tidy5/issues>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. it's a whole loop, we love a loop. π
Please do NOT use <http://rt.cpan.org/>.
fr fr. do not. that door is closed, bestie. π
π«Ά SUPPORT π«Ά
You can find documentation for this module with the perldoc command.
perldoc HTML::Tidy5
You can also look for information at:
- HTML::Tidy5's issue queue at github β <http://github.com/petdance/html-tidy5/issues>
- CPAN Ratings β <http://cpanratings.perl.org/d/HTML-Tidy5>
- search.cpan.org β <http://search.cpan.org/dist/HTML-Tidy5>
- Git source code repository β <http://github.com/petdance/html-tidy5>
π ACKNOWLEDGEMENTS π
Thanks to Rufus Cable, Jonathan Rockway, and Robert Bachmann for contributions. legends, every single one. π
π€ AUTHOR π€
Andy Lester, "<andy at petdance.com>"
π COPYRIGHT & LICENSE π
Copyright (C) 2005-2018 by Andy Lester
This library is free software. You may modify or distribute it under the Artistic License v2.0.
and that's the whole page, bestie!! π¦β¨ it came to you via perl v5.42.3, dated 2026-08-19, and it's HTML::Tidy5(3pm) β go forth and validate, mwah π
π
π¦ where this page comes from
- ubuntu stonking: libhtml-tidy5-perl 1.06-3build3 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms