Quick Reference

HTML Tidy Configuration Options

Generated automatically with HTML Tidy released on 19 September 2007.

HTML, XHTML, XML
Diagnostics
Pretty Print
Character Encoding
Miscellaneous

HTML, XHTML, XML Options Top
Option Type Default
add-xml-decl Boolean no
add-xml-space Boolean no
alt-text String -
assume-xml-procins Boolean no
bare Boolean no
clean Boolean no
css-prefix String -
decorate-inferred-ul Boolean no
doctype DocType auto
drop-empty-paras Boolean yes
drop-font-tags Boolean no
drop-proprietary-attributes Boolean no
enclose-block-text Boolean no
enclose-text Boolean no
escape-cdata Boolean no
fix-backslash Boolean yes
fix-bad-comments Boolean yes
fix-uri Boolean yes
hide-comments Boolean no
hide-endtags Boolean no
indent-cdata Boolean no
input-xml Boolean no
join-classes Boolean no
join-styles Boolean yes
literal-attributes Boolean no
logical-emphasis Boolean no
lower-literals Boolean yes
merge-divs AutoBool auto
merge-spans AutoBool auto
ncr Boolean yes
new-blocklevel-tags Tag names -
new-empty-tags Tag names -
new-inline-tags Tag names -
new-pre-tags Tag names -
numeric-entities Boolean no
output-html Boolean no
output-xhtml Boolean no
output-xml Boolean no
preserve-entities Boolean no
quote-ampersand Boolean yes
quote-marks Boolean no
quote-nbsp Boolean yes
repeated-attributes enum keep-last
replace-color Boolean no
show-body-only AutoBool no
uppercase-attributes Boolean no
uppercase-tags Boolean no
word-2000 Boolean no
 
Diagnostics Options Top
Option Type Default
accessibility-check enum 0 (Tidy Classic)
show-errors Integer 6
show-warnings Boolean yes
 
Pretty Print Options Top
Option Type Default
break-before-br Boolean no
indent AutoBool no
indent-attributes Boolean no
indent-spaces Integer 2
markup Boolean yes
punctuation-wrap Boolean no
sort-attributes enum none
split Boolean no
tab-size Integer 8
vertical-space Boolean no
wrap Integer 68
wrap-asp Boolean yes
wrap-attributes Boolean no
wrap-jste Boolean yes
wrap-php Boolean yes
wrap-script-literals Boolean no
wrap-sections Boolean yes
 
Character Encoding Options Top
Option Type Default
ascii-chars Boolean no
char-encoding Encoding ascii
input-encoding Encoding latin1
language String -
newline enum Platform dependent
output-bom AutoBool auto
output-encoding Encoding ascii
 
Miscellaneous Options Top
Option Type Default
error-file String -
force-output Boolean no
gnu-emacs Boolean no
gnu-emacs-file String -
keep-time Boolean no
output-file String -
quiet Boolean no
slide-style String -
tidy-mark Boolean yes
write-back Boolean no
 
 
HTML, XHTML, XML Options Reference
 
add-xml-decl
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
char-encoding
output-encoding
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
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
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
Type: String
Default: -
Example: -
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!
 
assume-xml-procins
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
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
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
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.
 
clean
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
drop-font-tags
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.
 
css-prefix
Type: String
Default: -
Example: -
This option specifies the prefix that Tidy uses for styles rules. By default, "c" will be used.
 
decorate-inferred-ul
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should decorate inferred UL elements with some CSS markup to avoid indentation to the right.
 
doctype
Type: DocType
Default: auto
Example: omit, auto, strict, transitional, user
This option specifies the DOCTYPE declaration generated by Tidy. If set to "omit" the output won't contain a DOCTYPE declaration. 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 strict DTD. If set to "loose", the DOCTYPE is set to the 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-paras
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should discard empty paragraphs.
 
drop-font-tags
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
clean
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
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should strip out proprietary attributes, such as MS data binding attributes.
 
enclose-block-text
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
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
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
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
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should convert <![CDATA[]]> sections to normal text.
 
fix-backslash
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should replace backslash characters "\" in URLs by forward slashes "/".
 
fix-bad-comments
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
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
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
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.
 
hide-comments
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should print out comments.
 
hide-endtags
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should omit optional end-tags when generating the pretty printed markup. This option is ignored if you are outputting to XML.
 
indent-cdata
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should indent <![CDATA[]]> sections.
 
input-xml
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should use the XML parser rather than the error correcting HTML parser.
 
join-classes
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
join-styles
repeated-attributes
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
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
join-classes
repeated-attributes
This option specifies if Tidy should combine styles to generate a single new style, if multiple style values are detected on an element.
 
literal-attributes
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should ensure that whitespace characters within attribute values are passed through unchanged.
 
logical-emphasis
Type: Boolean
Default: no
Example: y/n, yes/no, t/f, true/false, 1/0
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
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
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.
 
merge-divs
Type: AutoBool
Default: auto
Example: auto, y/n, yes/no, t/f, true/false, 1/0
clean
merge-spans
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-spans
Type: AutoBool
Default: auto
Example: auto, y/n, yes/no, t/f, true/false, 1/0
clean
merge-divs
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
Type: Boolean
Default: yes
Example: y/n, yes/no, t/f, true/false, 1/0
This option specifies if Tidy should allow numeric character references.