TIDY(1)

NAME
tidy - check, correct, and pretty-print HTML(5) files

SYNOPSIS
tidy [option ...] [file ...] [option ...] [file ...]

DESCRIPTION
Tidy reads HTML, XHTML, and XML files and writes cleaned-up markup. For HTML variants, it detects, reports, and corrects many common coding errors and strives to produce visually equivalent markup that is both conformant to the HTML specifications and that works in most browsers.

A common use of Tidy is to convert plain HTML to XHTML. For generic XML files, Tidy is limited to correcting basic well-formedness errors and pretty printing.

If no input file is specified, Tidy reads the standard input. If no output file is specified, Tidy writes the tidied markup to the standard output. If no error file is specified, Tidy writes messages to the standard error. For command line options that expect a numerical argument, a default is assumed if no meaningful value can be found.

OPTIONS

  File manipulation

-output <file>, -o <file>
    write output to the specified <file> (output-file: <file>)

-config <file>
    set configuration options from the specified <file>

-file <file>, -f <file>
    write errors and warnings to the specified <file> (error-file: <file>)

-modify, -m
    modify the original input files (write-back: yes)

  Processing directives

-indent, -i
    indent element content (indent: auto)

-wrap <column>, -w <column>
    wrap text at the specified <column>. 0 is assumed if <column> is missing. When this option is omitted, the default of the configuration option "wrap" applies. (wrap: <column>)

-upper, -u
    force tags to upper case (uppercase-tags: yes)

-clean, -c
    replace FONT, NOBR and CENTER tags by CSS (clean: yes)

-bare, -b
    strip out smart quotes and em dashes, etc. (bare: yes)

-gdoc, -g
    produce clean version of html exported by google docs (gdoc: yes)

-numeric, -n
    output numeric rather than named entities (numeric-entities: yes)

-errors, -e
    show only errors and warnings (markup: no)

-quiet, -q
    suppress nonessential output (quiet: yes)

-omit
    omit optional start tags and end tags (omit-optional-tags: yes)

-xml
    specify the input is well formed XML (input-xml: yes)

-asxml, -asxhtml
    convert HTML to well formed XHTML (output-xhtml: yes)

-ashtml
    force XHTML to well formed HTML (output-html: yes)

-access <level>
    do additional accessibility checks (<level> = 0, 1, 2, 3). 0 is assumed if <level> is missing. (accessibility-check: <level>)

  Character encodings

-raw
    output values above 127 without conversion to entities

-ascii
    use ISO-8859-1 for input, US-ASCII for output

-latin0
    use ISO-8859-15 for input, US-ASCII for output

-latin1
    use ISO-8859-1 for both input and output

-iso2022
    use ISO-2022 for both input and output

-utf8
    use UTF-8 for both input and output

-mac
    use MacRoman for input, US-ASCII for output

-win1252
    use Windows-1252 for input, US-ASCII for output

-ibm858
    use IBM-858 (CP850+Euro) for input, US-ASCII for output

-utf16le
    use UTF-16LE for both input and output

-utf16be
    use UTF-16BE for both input and output

-utf16
    use UTF-16 for both input and output

-big5
    use Big5 for both input and output

-shiftjis
    use Shift_JIS for both input and output

-language <lang>
    set the two-letter language code <lang> (for future use) (language: <lang>)

  Miscellaneous

-version, -v
    show the version of Tidy

-help, -h, -?
    list the command line options

-xml-help
    list the command line options in XML format

-help-config
    list all configuration options

-xml-config
    list all configuration options in XML format

-show-config
    list the current configuration settings

USAGE

Use --optionX valueX for the detailed configuration option "optionX" with argument "valueX". See also below under Detailed Configuration Options as to how to conveniently group all such options in a single config file.

Input/Output default to stdin/stdout respectively. Single letter options apart from -f and -o may be combined as in:

tidy -f errs.txt -imu foo.html

ENVIRONMENT

HTML_TIDY
    Name of the default configuration file. This should be an absolute path, since you will probably invoke tidy from different directories. The value of HTML_TIDY will be parsed after the compiled-in default (defined with -DTIDY_CONFIG_FILE), but before any of the files specified using -config.

EXIT STATUS

0   All input files were processed successfully.

1   There were warnings.

2   There were errors.

______________________________

DETAILED CONFIGURATION OPTIONS
This section describes the Detailed (i.e., "expanded") Options, which may be specified by preceding each option with -- at the command line, followed by its desired value, OR by placing the options and values in a configuration file, and telling tidy to read that file with the -config standard option.

SYNOPSIS
tidy --option1 value1 --option2 value2 [standard options ...]
tidy -config config-file [standard options ...]

WARNING
The options detailed here do not include the "standard" command-line options (i.e., those preceded by a single '-') described above in the first section of this man page.

DESCRIPTION
A list of options for configuring the behavior of Tidy, which can be passed either on the command line, or specified in a configuration file.

A Tidy configuration file is simply a text file, where each option is listed on a separate line in the form

option1: value1
option2: value2
etc.

The permissible values for a given option depend on the option's Type. There are five types: Boolean, AutoBool, DocType, Enum, and String. Boolean types allow any of yes/no, y/n, true/false, t/f, 1/0. AutoBools allow auto in addition to the values allowed by Booleans. Integer types take non-negative integers. String types generally have no defaults, and you should provide them in non-quoted form (unless you wish the output to contain the literal quotes).

Enum, Encoding, and DocType "types" have a fixed repertoire of items; consult the Example[s] provided below for the option[s] in question.

You only need to provide options and values for those whose defaults you wish to override, although you may wish to include some already-defaulted options and values for the sake of documentation and explicitness.

Here is a sample config file, with at least one example of each of the five Types:

    // sample Tidy configuration options
    output-xhtml: yes
    add-xml-decl: no
    doctype: strict
    char-encoding: ascii
    indent: auto
    wrap: 76
    repeated-attributes: keep-last
    error-file: errs.txt

Below is a summary and brief description of each of the options. They are listed alphabetically within each category. There are five categories: HTML, XHTML, XML options, Diagnostics options, Pretty Print options, Character Encoding options, and Miscellaneous options.

OPTIONS

  HTML, XHTML, XML options:

  Diagnostics options:

  Pretty Print options:

  Character Encoding options:

  Miscellaneous options:

SEE ALSO
For more information about HTML Tidy:

    http://www.html-tidy.org/

For more information on HTML:

    HTML: Edition for Web Authors (the latest HTML specification)
    http://dev.w3.org/html5/spec-author-view

    HTML: The Markup Language (an HTML language reference)
    http://dev.w3.org/html5/markup/

For bug reports and comments:

    https://github.com/htacg/tidy-html5/issues/

Or send questions and comments to public-htacg@w3.org.

Validate your HTML documents using the W3C Nu Markup Validator:

    http://validator.w3.org/nu/

AUTHOR
Tidy was written by Dave Raggett <dsr@w3.org>, and subsequently maintained by a team at http://tidy.sourceforge.net/, and now maintained by HTACG (http://www.htacg.org).

The sources for HTML Tidy are available at https://github.com/htacg/tidy-html5/ under the MIT Licence.