# Preferences

Preferences are changed in Window > Preferences > HTML Tidy or in a project Properties.

The options are described following the pattern:

Preferences label (original-tidy-option-name*: type)
  Description.

* "plug-in specific" or "JTidy specific", if it not an original HTML Tidy option.

## General Options

File Filter (Regular Expression) (plug-in specific: regular-expression)
  Only the files matching the regular expression are formatted or checked in the Package view.
Open file before Format or Check (plug-in specific: bool)
  If set to yes, the selected file(s) are opened before they are formatted or checked. It is similar to perform an Open action and then perform the Tidy Action in the opened editor. The default is no
Save all modified files prior to Format (plug-in specific: bool)
  If it is set to no (the default), a dialog box is shown to save or not a modified file before Formatting.
Silent (plug-in specific: bool)
  The default is no. If it is set to yes, no info dialog box is shown after Format or Check (only an error dialog box if Tidy couldn't format the file).
Quiet (quiet: bool)
  If set to yes, Tidy won't output the welcome message or the summary of the numbers of errors and warnings. The default is no.
Show warnings (show-warnings: bool)
  If set to no, warnings are suppressed. This can be useful when a few errors are hidden in a flurry of warnings. The default is yes.
Persistent problem markers (plug-in specific: bool)
  If set to yes (the default), the state of problem markers on files will be saved across workbench shutdown and startup.
Check file after Format (plug-in specific: bool)
  If set to yes, perform a Check action on the file after Format. In the Format Dialog Box, warnings and errors are those of the file before Format.
Error file (error-file: filename)
  Writes errors and warnings to the named file. This file is parsed to generate info, warnings and errors displayed to the user.

## Cleanup

Replace presentational tags and attributes by style rules (clean: bool)
  If set to yes, causes Tidy to strip out surplus presentational tags and attributes replacing them by style rules and structural markup as appropriate. It works well on the html saved from Microsoft Office'97. The default is no.
Discard <font> and <center> tags (drop-font-tags: bool)
  If set to yes together with the clean option (see above), Tidy will discard font and center tags rather than creating the corresponding style rules. The default is no.
Replace <i> by<em> and <b> by <strong> (logical-emphasis: bool)
  If set to yes, causes Tidy to replace any occurrence of i by em and any occurrence of b by strong. In both cases, the attributes are preserved unchanged. The default is no. This option can now be set independently of the clean and drop-font-tags options.
Discard empty paragraphs (drop-empty-paras: bool)
  If set to yes, empty paragraphs will be discarded. If set to no, empty paragraphs are replaced by a pair of `br` elements as HTML4 precludes empty paragraphs. The default is yes.
Source document is From MS Word 2000 (word-2000: bool)
  If set to yes, Tidy will go to great pains to strip out all the surplus stuff Microsoft Word 2000 inserts when you save Word documents as "Web pages". The default is no. Note that Tidy doesn't yet know what to do with VML markup from Word, but in future I hope to be able to map VML to SVG.
  Microsoft has developed its own optional filter for exporting to HTML, and the 2.0 version is much improved. You can download the filter free from the Microsoft Office Update site.
Fix bad comments (fix-bad-comments: bool)
  If set to yes, this causes Tidy to 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: <!---Â --->
Replace '\' in URLs by '/' (fix-backslash: bool)
  If set to yes, this causes backslash characters "\" in URLs to be replaced by forward slashes "/". The default is yes.

## Encoding

Character encoding (char-encoding: Raw, ASCII, Latin-1, UTF-8, ISO-2022 or MacRoman)
  Determines how Tidy interprets character streams. For ASCII, Tidy will accept Latin-1 character values, but will use entities for all characters whose value > 127. For Raw, Tidy will output values above 127 without translating them into entities. For Latin-1 characters above 255 will be written as entities. For UTF-8, Tidy assumes that both input and output is encoded as UTF-8. You can use ISO-2022 for files encoded using the ISO2022 family of encodings e.g. ISO 2022-JP. The default is ASCII.
Output numeric character entities (numeric-entities: bool)
  Causes entities other than the basic XML 1.0 named entities to be written in the numeric rather than the named entity form. The default is no
Output " character as &quot; (quote-marks: bool)
  If set to yes, this causes " characters to be written out as &quot; as is preferred by some editing environments. The apostrophe character ' is written out as &#39; since many web browsers don't yet support &apos;. The default is no.
Ouput non-breaking spaces as entities (quote-nbsp: bool)
  If set to yes, this causes non-breaking space characters to be written out as entities, rather than as the Unicode character value 160 (decimal). The default is yes.
Ouput unadorned & characters as &amp; (quote-ampersand: bool)
  If set to yes, this causes unadorned & characters to be written out as &amp;. The default is yes.

## Layout

Indent block-level tags (indent: no, yes or auto)
  If set to yes, Tidy will indent block-level tags. The default is no. If set to auto Tidy will decide whether or not to indent the content of tags such as title, h1-h6, li, td, th, 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 (indent-attributes: bool)
  If set to yes, each attribute will begin on a new line. The default is no.
Indent spaces (indent-spaces: number)
  Sets the number of spaces to indent content when indentation is enabled. The default is 2 spaces.
Wrap attributes values (wrap-attributes: bool)
  If set to yes, attribute values may be wrapped across lines for easier editing. The default is no. This option can be set independently of wrap-scriptlets
Wrap margin (wrap: number)
  Sets the right margin for line wrapping. Tidy tries to wrap lines so that they do not exceed this length. The default is 66. Set wrap to zero if you want to disable line wrapping.
Wrap script literals in script attributes (wrap-script-literals: bool)
  If set to yes, this allows lines to be wrapped within string literals that appear in script attributes. The default is no. The example shows how Tidy wraps a really really long script string literal inserting a backslash character before the linebreak:

      <a href="somewhere.html" onmouseover="document.status = '...some \
      really, really, really, really, really, really, really, really, \
      really, really long string..';">test</a>

Literal attributes (literal-attributes: bool)
  If set to yes, this ensures that whitespace characters within attribute values are passed through unchanged. The default is no.
Wrap lines in ASP pseudo elements (wrap-asp: bool)
  If set to no, this prevents lines from being wrapped within ASP pseudo elements, which look like: <%Â ...Â %>. The default is yes.
Wrap lines in JSTE pseudo elements (wrap-jste: bool)
  If set to no, this prevents lines from being wrapped within JSTE pseudo elements, which look like: <#Â ...Â #>. The default is yes.
Wrap lines in PHP pseudo elements (wrap-php: bool)
  If set to no, this prevents lines from being wrapped within PHP pseudo elements. The default is yes.
Wrap within <![...]> section tags (JTidy specific: bool)
  If set to no, this prevents lines from being wrap within <![ ... ]> section tags. The default is yes.
Break before <br> (break-before-br: bool)
  If set to yes, Tidy will output a line break before each <br> element. The default is no.
Uppercase tags (uppercase-tags: bool)
  Causes tag names to be output in upper case. The default is no resulting in lowercase, except for XML input where the original case is preserved.
Uppercase attributes (uppercase-attributes: bool)
  If set to yes attribute names are output in upper case. The default is no resulting in lowercase, except for XML where the original case is preserved.
Spaces/tab on input (tab-size: number)
  Sets the number of columns between successive tab stops. The default is 4. It is used to map tabs to spaces when reading files. Tidy never outputs files with tabs.

## Markup

Doctype (doctype: omit, auto, strict, loose or <fpi>)
  This property controls the doctype declaration generated by Tidy. If set to omit the output file 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:

          "-//ACME//DTD HTML 3.14159//EN"

  Enclosing quotes must be written.
  If you specify the fpi for an XHTML document, Tidy will set the system identifier to the empty string. Tidy leaves the document type for generic XML documents unchanged.
Add Tidy Meta element (tidy-mark: bool)
  If set to yes (the default) Tidy will add a meta element to the document head to indicate that the document has been tidied. To suppress this, set tidy-mark to no. Tidy won't add a meta element if one is already present.
Suppress optional end tags (hide-endtags: bool)
  If set to yes, optional end-tags will be omitted when generating the pretty printed markup. This option is ignored if you are outputting to XML. The default is no.
Enclose text in body within p elements (enclose-text: bool)
  If set to yes, this causes Tidy to enclose any text it finds in the body element within a p element. This is useful when you want to take an existing html file and use it with a style sheet. Any text at the body level will screw up the margins, but wrap the text within a p element and all is well! The default is no.
Enclose text in blocks within p elements (enclose-block-text: bool)
  If set to yes, this causes Tidy to insert a p element to enclose any text it finds in any element that allows mixed content for HTML transitional but not HTML strict. The default is no.
New empty tags (new-empty-tags: tag1, tag2, tag3)
  Use this to declare new empty inline tags. The 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, see below.
New inline tags (new-inline-tags: tag1, tag2, tag3)
  Use this to declare new non-empty inline tags. The 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.
New block-level tags (new-blocklevel-tags: tag1, tag2, tag3)
  Use this to declare new block-level tags. The 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 is explained in more detail in the release notes.
New pre tags (new-pre-tags: tag1, tag2, tag3)
  Use this to declare new tags that are to be processed in exactly the same way as HTML's pre element. The 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 as yet add new CDATA elements (similar to script).

## XML

Input is XML (input-xml: bool)
  If set to yes, Tidy will use the XML parser rather than the error correcting HTML parser. The default is no.
Output as XML (output-xml: bool)
  If set to yes, Tidy will generate the pretty printed 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 an XML parser. The tags and attributes will be in the case used in the input document, regardless of other options. The default is no.
Output as XHTML (output-xhtml: bool)
  If set to yes, Tidy will generate the pretty printed output writing it as extensible HTML. The default is no. 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 value of the "numeric-entities" property. The tags and attributes will be output in the case used in the input document, regardless of other options.
Add XML declaration (add-xml-decl or add-xml-pi: bool)
  If set to yes, Tidy will add the XML declatation when outputting XML or XHTML. The default is no. Note that if the input document includes an <?xml?> declaration then it will appear in the output independent of the value of this option.
Add XML processing instructions (assume-xml-procins: bool)
  If set to yes, this changes the parsing of processing instructions to require ?> as the terminator rather than >. The default is no. This option is automatically set if the input is in XML.
Add xml:space attribute as needed (add-xml-space: bool)
  If set to yes, this causes Tidy to 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. The default is no.

With Dave Ragget's authorization, this file is derived from http://www.w3.org/People/Raggett/tidy (The original document is Copyright© 1994-2003 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C liability, trademark and document use rules apply.)