NAME
HTML::Valid - tidy/validate HTML
SYNOPSIS
use FindBin '$Bin';
use HTML::Valid;
my $html = <<EOF;
<ul>
<li>Shape it up
<li>Get straight
<li>Go forward
<li>Move ahead
<li>Try to detect it
<li>It's not too late
EOF
my $htv = HTML::Valid->new ();
my ($output, $errors) = $htv->run ($html);
print "$output\n";
print "$errors\n";
outputs
<!DOCTYPE html>
<html>
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for FreeBSD version 5.0.0">
<title></title>
</head>
<body>
<ul>
<li>Shape it up</li>
<li>Get straight</li>
<li>Go forward</li>
<li>Move ahead</li>
<li>Try to detect it</li>
<li>It's not too late</li>
</ul>
</body>
</html>
line 1 column 1 - Warning: missing <!DOCTYPE> declaration
line 1 column 1 - Warning: inserting implicit <body>
line 1 column 1 - Warning: missing </ul>
line 1 column 1 - Warning: inserting missing 'title' element
Info: Document content looks like HTML5
4 warnings, 0 errors were found!
VERSION
This document describes HTML::Valid version 0.02_02. This corresponds to "HTML Tidy" version 5.0.0.
DESCRIPTION
Validate/repair HTML. This module is based on "HTML Tidy", but not on the Perl module HTML::Tidy. However, you do not need to install HTML Tidy before installing this, because the library is contained in the distribution.
FUNCTIONS
new
my $htv = HTML::Valid->new ();
Make a new HTML::Valid object.
It's also possible to supply options, as described in "OPTIONS":
$htv->new (
show_body_only => 1,
alt_text => 'An image of a polar bear',
);
run
my ($output, $errors) = $htv->run ($content);
Get the tidy HTML output and errors. This is basically the same thing as running the "tidy" utility with the given options.
set_filename
$htv->set_filename ('file.html');
Set the file name for error reporting to file.html.
set_option
$htv->set_option ('omit-optional-tags', 1);
Most of the options of "HTML Tidy" are supported.
OPTIONS
The following options can be set with "set_option". In this documentation they are given with a hyphen, but underscores can also be used. Options taking true or false values test for truth or falsehood using the standard Perl tests, so empty strings, the undefined value, or zero are all valid "false" values.
Please note the following documentation of the options is automatically extracted from the "HTML Tidy" documentation. Some external links in the following documentation are known not to work with this version of HTML Tidy.
- accessibility-check
-
$htv->set_option ('accessibility-check', <value>);
Type: integer
Default: 0
This option specifies what level of accessibility checking, if any, that Tidy should do. Level 0 is equivalent to Tidy Classic's accessibility checking. For more information on Tidy's accessibility checking, visit the Adaptive Technology Resource Centre at the University of Toronto.
- add-xml-decl
-
$htv->set_option ('add-xml-decl', <value>);
Type: true or false
Default: false
This option specifies if Tidy should add the XML declaration when outputting XML or XHTML. Note that if the input already includes an <?xml ... ?> declaration then this option will be ignored. If the encoding for the output is different from "ascii", one of the utf encodings or "raw", the declaration is always added as required by the XML standard.
- add-xml-space
-
$htv->set_option ('add-xml-space', <value>);
Type: true or false
Default: false
This option specifies if Tidy should add xml:space="preserve" to elements such as <PRE>, <STYLE> and <SCRIPT> when generating XML. This is needed if the whitespace in such elements is to be parsed appropriately without having access to the DTD.
- alt-text
-
$htv->set_option ('alt-text', <value>);
Type: string
Default: <empty>
This option specifies the default "alt=" text Tidy uses for <IMG> attributes. This feature is dangerous as it suppresses further accessibility warnings. You are responsible for making your documents accessible to people who can not see the images!
- anchor-as-name
-
$htv->set_option ('anchor-as-name', <value>);
Type: true or false
Default: true
This option controls the deletion or addition of the name attribute in elements where it can serve as anchor. If set to "yes", a name attribute, if not already existing, is added along an existing id attribute if the DTD allows it. If set to "no", any existing name attribute is removed if an id attribute exists or has been added.
- ascii-chars
-
$htv->set_option ('ascii-chars', <value>);
Type: true or false
Default: false
Can be used to modify behavior of -c (--clean yes) option. If set to "yes" when using -c, &emdash;, ”, and other named character entities are downgraded to their closest ascii equivalents.
- assume-xml-procins
-
$htv->set_option ('assume-xml-procins', <value>);
Type: true or false
Default: false
This option specifies if Tidy should change the parsing of processing instructions to require ?> as the terminator rather than >. This option is automatically set if the input is in XML.
- bare
-
$htv->set_option ('bare', <value>);
Type: true or false
Default: false
This option specifies if Tidy should strip Microsoft specific HTML from Word 2000 documents, and output spaces rather than non-breaking spaces where they exist in the input.
- break-before-br
-
$htv->set_option ('break-before-br', <value>);
Type: true or false
Default: false
This option specifies if Tidy should output a line break before each <BR> element.
- clean
-
$htv->set_option ('clean', <value>);
Type: true or false
Default: false
This option specifies if Tidy should strip out surplus presentational tags and attributes replacing them by style rules and structural markup as appropriate. It works well on the HTML saved by Microsoft Office products.
-
$htv->set_option ('coerce-endtags', <value>);
Type: true or false
Default: true
This option specifies if Tidy should coerce a start tag into an end tag in cases where it looks like an end tag was probably intended; for example, given <span>foo <b>bar<b> baz</span>, Tidy will output <span>foo <b>bar</b> baz</span>.
- css-prefix
-
$htv->set_option ('css-prefix', <value>);
Type: string
Default: <empty>
This option specifies the prefix that Tidy uses for styles rules. By default, "c" will be used.
- decorate-inferred-ul
-
$htv->set_option ('decorate-inferred-ul', <value>);
Type: true or false
Default: false
This option specifies if Tidy should decorate inferred UL elements with some CSS markup to avoid indentation to the right.
- doctype
-
$htv->set_option ('doctype', <value>);
Type: string
Default: <empty>
This option specifies the DOCTYPE declaration generated by Tidy.
If set to "omit" the output won't contain a DOCTYPE declaration.
If set to "html5" the DOCTYPE is set to "<!DOCTYPE html>".
If set to "auto" (the default) Tidy will use an educated guess based upon the contents of the document.
If set to "strict", Tidy will set the DOCTYPE to the HTML4 or XHTML1 strict DTD.
If set to "loose", the DOCTYPE is set to the HTML4 or XHTML1 loose (transitional) DTD.
Alternatively, you can supply a string for the formal public identifier (FPI).
For example:
doctype: "-//ACME//DTD HTML 3.14159//EN"
If you specify the FPI for an XHTML document, Tidy will set the system identifier to an empty string. For an HTML document, Tidy adds a system identifier only if one was already present in order to preserve the processing mode of some browsers. Tidy leaves the DOCTYPE for generic XML documents unchanged.
--doctype omit
implies--numeric-entities yes
. This option does not offer a validation of the document conformance. - drop-empty-elements
-
$htv->set_option ('drop-empty-elements', <value>);
Type: true or false
Default: true
This option specifies if Tidy should discard empty elements.
- drop-empty-paras
-
$htv->set_option ('drop-empty-paras', <value>);
Type: true or false
Default: true
This option specifies if Tidy should discard empty paragraphs.
-
$htv->set_option ('drop-font-tags', <value>);
Type: true or false
Default: false
This option specifies if Tidy should discard <FONT> and <CENTER> tags without creating the corresponding style rules. This option can be set independently of the clean option.
- drop-proprietary-attributes
-
$htv->set_option ('drop-proprietary-attributes', <value>);
Type: true or false
Default: false
This option specifies if Tidy should strip out proprietary attributes, such as MS data binding attributes.
- enclose-block-text
-
$htv->set_option ('enclose-block-text', <value>);
Type: true or false
Default: false
This option specifies if Tidy should insert a <P> element to enclose any text it finds in any element that allows mixed content for HTML transitional but not HTML strict.
- enclose-text
-
$htv->set_option ('enclose-text', <value>);
Type: true or false
Default: false
This option specifies if Tidy should enclose any text it finds in the body element within a <P> element. This is useful when you want to take existing HTML and use it with a style sheet.
- escape-cdata
-
$htv->set_option ('escape-cdata', <value>);
Type: true or false
Default: false
This option specifies if Tidy should convert <![CDATA[]]> sections to normal text.
- fix-backslash
-
$htv->set_option ('fix-backslash', <value>);
Type: true or false
Default: true
This option specifies if Tidy should replace backslash characters "
\
" in URLs by forward slashes "/
". - fix-bad-comments
-
$htv->set_option ('fix-bad-comments', <value>);
Type: true or false
Default: true
This option specifies if Tidy should replace unexpected hyphens with "=" characters when it comes across adjacent hyphens. The default is yes. This option is provided for users of Cold Fusion which uses the comment syntax: <!--- --->
- fix-uri
-
$htv->set_option ('fix-uri', <value>);
Type: true or false
Default: true
This option specifies if Tidy should check attribute values that carry URIs for illegal characters and if such are found, escape them as HTML 4 recommends.
- force-output
-
$htv->set_option ('force-output', <value>);
Type: true or false
Default: false
This option specifies if Tidy should produce output even if errors are encountered. Use this option with care - if Tidy reports an error, this means Tidy was not able to, or is not sure how to, fix the error, so the resulting output may not reflect your intention.
- gdoc
-
$htv->set_option ('gdoc', <value>);
Type: true or false
Default: false
This option specifies if Tidy should enable specific behavior for cleaning up HTML exported from Google Docs.
- gnu-emacs
-
$htv->set_option ('gnu-emacs', <value>);
Type: true or false
Default: false
This option specifies if Tidy should change the format for reporting errors and warnings to a format that is more easily parsed by GNU Emacs.
- hide-comments
-
$htv->set_option ('hide-comments', <value>);
Type: true or false
Default: false
This option specifies if Tidy should print out comments.
-
$htv->set_option ('hide-endtags', <value>);
Type: true or false
Default: false
This option is an alias for omit-optional-tags.
- indent
-
$htv->set_option ('indent', <value>);
Type: integer
Default: 0
This option specifies if Tidy should indent block-level tags. If set to "auto", this option causes Tidy to decide whether or not to indent the content of tags such as TITLE, H1-H6, LI, TD, TD, or P depending on whether or not the content includes a block-level element. You are advised to avoid setting indent to yes as this can expose layout bugs in some browsers.
- indent-attributes
-
$htv->set_option ('indent-attributes', <value>);
Type: true or false
Default: false
This option specifies if Tidy should begin each attribute on a new line.
- indent-cdata
-
$htv->set_option ('indent-cdata', <value>);
Type: true or false
Default: false
This option specifies if Tidy should indent <![CDATA[]]> sections.
- indent-spaces
-
$htv->set_option ('indent-spaces', <value>);
Type: integer
Default: 2
This option specifies the number of spaces Tidy uses to indent content, when indentation is enabled.
- indent-with-tabs
-
$htv->set_option ('indent-with-tabs', <value>);
Type: true or false
Default: false
Set this option "on" to indent using tabs instead of the default spaces. The option TidyIndentSpaces controls the number of tabs output per level of indent, which is reset to 1, when this option is set on. And of course, indent must be enabled for this to have any effect. Note TidyTabSize controls converting input tabs to spaces. Set to zero to retain input tabs.
- input-xml
-
$htv->set_option ('input-xml', <value>);
Type: true or false
Default: false
This option specifies if Tidy should use the XML parser rather than the error correcting HTML parser.
- join-classes
-
$htv->set_option ('join-classes', <value>);
Type: true or false
Default: false
This option specifies if Tidy should combine class names to generate a single new class name, if multiple class assignments are detected on an element.
- join-styles
-
$htv->set_option ('join-styles', <value>);
Type: true or false
Default: true
This option specifies if Tidy should combine styles to generate a single new style, if multiple style values are detected on an element.
- language
-
$htv->set_option ('language', <value>);
Type: string
Default: <empty>
Currently not used, but this option specifies the language Tidy uses (for instance "en").
- literal-attributes
-
$htv->set_option ('literal-attributes', <value>);
Type: true or false
Default: false
This option specifies how Tidy deals with whitespace characters within attribute values. If the value is "no" (the default), Tidy "munges" or "normalizes" attribute values by replacing any newline or tab character with a single space character, and further by replacing any sequences of multiple whitespace characters with a single space. To force tidy to preserve the original, literal values of all attributes, and ensure that whitespace characters within attribute values are passed through unchanged, set this option to "yes".
- logical-emphasis
-
$htv->set_option ('logical-emphasis', <value>);
Type: true or false
Default: false
This option specifies if Tidy should replace any occurrence of <I> by <EM> and any occurrence of <B> by <STRONG>. In both cases, the attributes are preserved unchanged. This option can be set independently of the clean and drop-font-tags options.
- lower-literals
-
$htv->set_option ('lower-literals', <value>);
Type: true or false
Default: true
This option specifies if Tidy should convert the value of an attribute that takes a list of predefined values to lower case. This is required for XHTML documents.
- markup
-
$htv->set_option ('markup', <value>);
Type: true or false
Default: true
This option specifies if Tidy should generate a pretty printed version of the markup. Note that Tidy won't generate a pretty printed version if it finds significant errors (see force-output).
- merge-divs
-
$htv->set_option ('merge-divs', <value>);
Type: integer
Default: 2
Can be used to modify behavior of -c (--clean yes) option. This option specifies if Tidy should merge nested <div> such as "<div><div>...</div></div>". If set to "auto", the attributes of the inner <div> are moved to the outer one. As well, nested <div> with ID attributes are not merged. If set to "yes", the attributes of the inner <div> are discarded with the exception of "class" and "style".
- merge-emphasis
-
$htv->set_option ('merge-emphasis', <value>);
Type: true or false
Default: true
This option specifies if Tidy should merge nested <b> and <i> elements; for example, for the case <b class="rtop-2">foo <b class="r2-2">bar</b> baz</b>, Tidy will output <b class="rtop-2">foo bar baz</b>.
- merge-spans
-
$htv->set_option ('merge-spans', <value>);
Type: integer
Default: 2
Can be used to modify behavior of -c (--clean yes) option. This option specifies if Tidy should merge nested <span> such as "<span><span>...</span></span>". The algorithm is identical to the one used by --merge-divs.
- ncr
-
$htv->set_option ('ncr', <value>);
Type: true or false
Default: true
This option specifies if Tidy should allow numeric character references.
-
$htv->set_option ('new-blocklevel-tags', <value>);
Type: string
Default: <empty>
This option specifies new block-level tags. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Note you can't change the content model for elements such as <TABLE>, <UL>, <OL> and <DL>. This option is ignored in XML mode.
-
$htv->set_option ('new-empty-tags', <value>);
Type: string
Default: <empty>
This option specifies new empty inline tags. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Remember to also declare empty tags as either inline or blocklevel. This option is ignored in XML mode.
-
$htv->set_option ('new-inline-tags', <value>);
Type: string
Default: <empty>
This option specifies new non-empty inline tags. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. This option is ignored in XML mode.
-
$htv->set_option ('new-pre-tags', <value>);
Type: string
Default: <empty>
This option specifies new tags that are to be processed in exactly the same way as HTML's <PRE> element. This option takes a space or comma separated list of tag names. Unless you declare new tags, Tidy will refuse to generate a tidied file if the input includes previously unknown tags. Note you can not as yet add new CDATA elements (similar to <SCRIPT>). This option is ignored in XML mode.
- newline
-
$htv->set_option ('newline', <value>);
Type: integer
Default: 0
The default is appropriate to the current platform: CRLF on PC-DOS, MS-Windows and OS/2, CR on Classic Mac OS, and LF everywhere else (Unix and Linux).
- numeric-entities
-
$htv->set_option ('numeric-entities', <value>);
Type: true or false
Default: false
This option specifies if Tidy should output entities other than the built-in HTML entities (&, <, > and ") in the numeric rather than the named entity form. Only entities compatible with the DOCTYPE declaration generated are used. Entities that can be represented in the output encoding are translated correspondingly.
-
$htv->set_option ('omit-optional-tags', <value>);
Type: true or false
Default: false
This option specifies if Tidy should omit optional start tags and end tags when generating output. Setting this option causes all tags for the html, head, and body elements to be omitted from output, as well as such end tags as </p>, </li>, </dt>, </dd>, </option>, </tr>, </td>, and </th>. This option is ignored for XML output.
- output-html
-
$htv->set_option ('output-html', <value>);
Type: true or false
Default: false
This option specifies if Tidy should generate pretty printed output, writing it as HTML.
- output-xhtml
-
$htv->set_option ('output-xhtml', <value>);
Type: true or false
Default: false
This option specifies if Tidy should generate pretty printed output, writing it as extensible HTML. This option causes Tidy to set the DOCTYPE and default namespace as appropriate to XHTML. If a DOCTYPE or namespace is given they will checked for consistency with the content of the document. In the case of an inconsistency, the corrected values will appear in the output. For XHTML, entities can be written as named or numeric entities according to the setting of the "numeric-entities" option. The original case of tags and attributes will be preserved, regardless of other options.
- output-xml
-
$htv->set_option ('output-xml', <value>);
Type: true or false
Default: false
This option specifies if Tidy should pretty print output, writing it as well-formed XML. Any entities not defined in XML 1.0 will be written as numeric entities to allow them to be parsed by a XML parser. The original case of tags and attributes will be preserved, regardless of other options.
- preserve-entities
-
$htv->set_option ('preserve-entities', <value>);
Type: true or false
Default: false
This option specifies if Tidy should preserve the well-formed entities as found in the input.
- punctuation-wrap
-
$htv->set_option ('punctuation-wrap', <value>);
Type: true or false
Default: false
This option specifies if Tidy should line wrap after some Unicode or Chinese punctuation characters.
- quiet
-
$htv->set_option ('quiet', <value>);
Type: true or false
Default: false
This option specifies if Tidy should output the summary of the numbers of errors and warnings, or the welcome or informational messages.
- quote-ampersand
-
$htv->set_option ('quote-ampersand', <value>);
Type: true or false
Default: true
This option specifies if Tidy should output unadorned & characters as &.
- quote-marks
-
$htv->set_option ('quote-marks', <value>);
Type: true or false
Default: false
This option specifies if Tidy should output " characters as " as is preferred by some editing environments. The apostrophe character ' is written out as ' since many web browsers don't yet support '.
- quote-nbsp
-
$htv->set_option ('quote-nbsp', <value>);
Type: true or false
Default: true
This option specifies if Tidy should output non-breaking space characters as entities, rather than as the Unicode character value 160 (decimal).
- repeated-attributes
-
$htv->set_option ('repeated-attributes', <value>);
Type: integer
Default: 1
This option specifies if Tidy should keep the first or last attribute, if an attribute is repeated, e.g. has two align attributes.
- replace-color
-
$htv->set_option ('replace-color', <value>);
Type: true or false
Default: false
This option specifies if Tidy should replace numeric values in color attributes by HTML/XHTML color names where defined, e.g. replace "#ffffff" with "white".
- show-body-only
-
$htv->set_option ('show-body-only', <value>);
Type: integer
Default: 0
This option specifies if Tidy should print only the contents of the body tag as an HTML fragment. If set to "auto", this is performed only if the body tag has been inferred. Useful for incorporating existing whole pages as a portion of another page. This option has no effect if XML output is requested.
- show-errors
-
$htv->set_option ('show-errors', <value>);
Type: integer
Default: 6
This option specifies the number Tidy uses to determine if further errors should be shown. If set to 0, then no errors are shown.
- show-info
-
$htv->set_option ('show-info', <value>);
Type: true or false
Default: true
This option specifies if Tidy should display info-level messages.
- show-warnings
-
$htv->set_option ('show-warnings', <value>);
Type: true or false
Default: true
This option specifies if Tidy should suppress warnings. This can be useful when a few errors are hidden in a flurry of warnings.
- slide-style
-
$htv->set_option ('slide-style', <value>);
Type: string
Default: <empty>
Currently not used. Tidy Classic only.
- sort-attributes
-
$htv->set_option ('sort-attributes', <value>);
Type: integer
Default: 0
This option specifies that tidy should sort attributes within an element using the specified sort algorithm. If set to "alpha", the algorithm is an ascending alphabetic sort.
- split
-
$htv->set_option ('split', <value>);
Type: true or false
Default: false
Currently not used. Tidy Classic only.
- tab-size
-
$htv->set_option ('tab-size', <value>);
Type: integer
Default: 8
This option specifies the number of columns that Tidy uses between successive tab stops. It is used to map tabs to spaces when reading the input.
- tidy-mark
-
$htv->set_option ('tidy-mark', <value>);
Type: true or false
Default: true
This option specifies if Tidy should add a meta element to the document head to indicate that the document has been tidied. Tidy won't add a meta element if one is already present.
- uppercase-attributes
-
$htv->set_option ('uppercase-attributes', <value>);
Type: true or false
Default: false
This option specifies if Tidy should output attribute names in upper case. The default is no, which results in lower case attribute names, except for XML input, where the original case is preserved.
-
$htv->set_option ('uppercase-tags', <value>);
Type: true or false
Default: false
This option specifies if Tidy should output tag names in upper case. The default is no, which results in lower case tag names, except for XML input, where the original case is preserved.
- vertical-space
-
$htv->set_option ('vertical-space', <value>);
Type: true or false
Default: false
This option specifies if Tidy should add some empty lines for readability.
- word-2000
-
$htv->set_option ('word-2000', <value>);
Type: true or false
Default: false
This option specifies if Tidy should go to great pains to strip out all the surplus stuff Microsoft Word 2000 inserts when you save Word documents as "Web pages". Doesn't handle embedded images or VML. You should consider using Word's "Save As: Web Page, Filtered".
- wrap
-
$htv->set_option ('wrap', <value>);
Type: integer
Default: 68
This option specifies the right margin Tidy uses for line wrapping. Tidy tries to wrap lines so that they do not exceed this length. Set wrap to zero if you want to disable line wrapping.
- wrap-asp
-
$htv->set_option ('wrap-asp', <value>);
Type: true or false
Default: true
This option specifies if Tidy should line wrap text contained within ASP pseudo elements, which look like: <% ... %>.
- wrap-attributes
-
$htv->set_option ('wrap-attributes', <value>);
Type: true or false
Default: false
This option specifies if Tidy should line-wrap attribute values, for easier editing. Line wrapping means that if the value of an attribute causes a line to exceed the width specified by the "wrap" option, tidy will add one or more line breaks to the value, causing it to wrapped into multiple lines. Note that this option can be set independently of wrap-script-literals. Also note that by default, Tidy "munges" or "normalizes" attribute values by replacing any newline or tab character with a single space character, and further by replacing any sequences of multiple whitespace characters with a single space. To force Tidy to preserve the original, literal values of all attributes, and ensure that whitespace characters within attribute values are passed through unchanged, set the literal-attributes option to "yes".
- wrap-jste
-
$htv->set_option ('wrap-jste', <value>);
Type: true or false
Default: true
This option specifies if Tidy should line wrap text contained within JSTE pseudo elements, which look like: <# ... #>.
- wrap-php
-
$htv->set_option ('wrap-php', <value>);
Type: true or false
Default: true
This option specifies if Tidy should line wrap text contained within PHP pseudo elements, which look like: <?php ... ?>.
- wrap-script-literals
-
$htv->set_option ('wrap-script-literals', <value>);
Type: true or false
Default: false
This option specifies if Tidy should line wrap string literals that appear in script attributes. Tidy wraps long script string literals by inserting a backslash character before the line break.
- wrap-sections
-
$htv->set_option ('wrap-sections', <value>);
Type: true or false
Default: true
This option specifies if Tidy should line wrap text contained within <![ ... ]> section tags.
SCRIPT
There are two scripts, "htmlok", which runs on files or URLs and prints errors found to standard output, and "htmltidy", which runs on files or URLs and prints the reformatted HTML to standard output, with errors going to standard error. To use these scripts with URL validation, you need to have Data::Validate::URI and LWP::Simple installed.
SEE ALSO
HTML Tidy
This is a program and a library in C for improving HTML. It was originally written by Dave Raggett of the W3 Consortium. HTML::Valid is based on this project.
Please note that this is not the Perl module HTML::Tidy by Andy Lester, although that module is also based on the above library.
HTML standards
This section gives links to the HTML standards which HTML::Valid supports.
HTML 2.0
HTML 2.0 was described in RFC ("Request For Comments") 1866, a standard of the Internet Engineering Task Force. See http://www.ietf.org/rfc/rfc1866.txt.
HTML 3.2
This was described in the HTML 3.2 Reference Specification. See http://www.w3.org/TR/REC-html32.
HTML 4.01
This was described in the HTML 4.01 Specification. See http://www.w3.org/TR/html401/.
HTML5
- Dive into HTML5
-
This isn't a standards document, but "Dive into HTML 5" may be good background reading before trying to read the standards documents.
- HTML: The Living Standard
-
This is at https://developers.whatwg.org/. It says
This specification is intended for authors of documents and scripts that use the features defined in this specification.
- HTML5 - A vocabulary and associated APIs for HTML and XHTML
-
This is at http://www.w3.org/TR/html5/. It's the W3 consortium's version of the WHATWG documents.
Online HTML validators
You may like to try these validators for checking your HTML.
- http://www.onlinewebcheck.com/
-
Commercial HTML validator.
- http://watson.addy.com/
- https://validator.w3.org/
-
W3 Consortium validator.
- https://validator.w3.org/nu/
-
New W3 Consortium validator.
CPAN modules
- HTML::Tidy
- HTML::Lint
- HTML::Validator
-
There is another module called HTML::Validator, but it can only found on Backpan, dating from 2000. It uses an external XML validating tool.
BUILD PROCESS
This module is built from "HTML Tidy" source code using a script which converts the HTML Tidy library into a single C file. This is available in the github repository as tools/make-c-file.pl, but is not included in the CPAN distribution. This also includes extra C functions in extra.c into the library to access internals which are not part of the public interface. This is used for creating the machine-readable file of option documentation included above in "OPTIONS" and for creating the tables of tags and attributes in HTML::Valid::Tagset.
As someone who's previously released two modules depending on third-party libraries, Image::PNG::Libpng and Gzip::Faster, I've had to deal with a lot of problems caused by incompatibilities, libraries not found, unknown compilation options, and other things which are on other people's computers, and completely beyond my control, and often highly mysterious. Based on that experience, and taking a hint from the SQLite project and from the DBD::SQLite Perl module, I decided to go down the path of making a single C file from HTML Tidy, based on a fixed version, and including that in the Perl distribution, so that I can have some hope of fixing whatever issues happen in compiling the library, and so that if other people want to use this module, they won't have to suffer through trying to install yet another library.
SUPPORT
If you have a problem with this module, although it's based on "HTML Tidy", please report it via this Perl module's issues page first, since, although this is not a fork of HTML Tidy, it's possible that some part of the build process (see "BUILD PROCESS") has caused the issue rather than the HTML Tidy library itself. Also note that the version of "HTML Tidy" used to build this is going to be the stable version released by the project, and thus will lag behind the most current version on github. Hence some of the issues with this module may already have been reported or even fixed in the most current branch.
AUTHOR
Ben Bullock <bkb@cpan.org>
COPYRIGHT AND LICENCE
HTML::Valid is based on HTML Tidy, which is under the following copyright:
Copyright (c) 1998-2008 World Wide Web Consortium
(Massachusetts Institute of Technology, European Research
Consortium for Informatics and Mathematics, Keio University).
All Rights Reserved.
COPYRIGHT NOTICE:
This software and documentation is provided "as is," and
the copyright holders and contributing author(s) make no
representations or warranties, express or implied, including
but not limited to, warranties of merchantability or fitness
for any particular purpose or that the use of the software or
documentation will not infringe any third party patents,
copyrights, trademarks or other rights.
The copyright holders and contributing author(s) will not be held
liable for any direct, indirect, special or consequential damages
arising out of any use of the software or documentation, even if
advised of the possibility of such damage.
Permission is hereby granted to use, copy, modify, and distribute
this source code, or portions hereof, documentation and executables,
for any purpose, without fee, subject to the following restrictions:
1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must
not be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any
source or altered source distribution.
The Perl parts of this distribution are copyright (C) 2015 Ben Bullock and may be used under either the above licence terms, or the usual Perl conditions, either the GNU General Public Licence or the Perl Artistic Licence.