1TIDY(1)                              5.8.0                             TIDY(1)
2
3
4

NAME

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

SYNOPSIS

9       tidy [options] [file ...] [options] [file ...] ...
10

DESCRIPTION

12       Tidy reads HTML, XHTML, and XML files and writes cleaned-up markup.
13       For HTML variants, it detects, reports, and corrects many common coding
14       errors and strives to produce visually equivalent markup that is both
15       conformant to the HTML specifications and that works in most browsers.
16
17       A common use of Tidy is to convert plain HTML to XHTML.  For generic
18       XML files, Tidy is limited to correcting basic well-formedness errors
19       and pretty printing.
20
21       If no input file is specified, Tidy reads the standard input.  If no
22       output file is specified, Tidy writes the tidied markup to the standard
23       output.  If no error file is specified, Tidy writes messages to the
24       standard error.
25

OPTIONS

27       Tidy supports two different kinds of options.  Purely command-line
28       options, starting with a single dash '-', can only be used on the
29       command-line, not in configuration files.  They are listed in the first
30       part of this section.  Configuration options, on the other hand, can
31       either be passed on the command line, starting with two dashes --, or
32       specified in a configuration file, using the option name, followed by a
33       colon :, plus the value, without the starting dashes. They are listed
34       in the second part of this section, with a sample config file.
35
36       For command-line options that expect a numerical argument, a default is
37       assumed if no meaningful value can be found.  On the other hand,
38       configuration options cannot be used without a value; a configuration
39       option without a value is simply discarded and reported as an error.
40
41       Using a command-line option is sometimes equivalent to setting the
42       value of a configuration option.  The equivalent option and value are
43       shown in parentheses in the list below, as they would appear in a
44       configuration file.  For example, -quiet, -q (quiet: yes) means that
45       using the command-line option -quiet or -q is equivalent to setting the
46       configuration option quiet to yes.
47
48       Single-letter command-line options without an associated value can be
49       combined; for example '-i', '-m' and '-u' may be combined as '-imu'.
50
51   File manipulation
52       -output <file>, -o <file> (output-file: <file>)
53              write output to the specified <file>
54
55       -config <file>
56              set configuration options from the specified <file>
57
58       -file <file>, -f <file> (error-file: <file>)
59              write errors and warnings to the specified <file>
60
61       -modify, -m (write-back: yes)
62              modify the original input files
63
64   Processing directives
65       -indent, -i (indent: auto)
66              indent element content
67
68       -wrap <column>, -w <column> (wrap: <column>)
69              wrap text at the specified <column>. 0 is assumed if <column> is
70              missing. When this option is omitted, the default of the
71              configuration option 'wrap' applies.
72
73       -upper, -u (uppercase-tags: yes)
74              force tags to upper case
75
76       -clean, -c (clean: yes)
77              replace FONT, NOBR and CENTER tags with CSS
78
79       -bare, -b (bare: yes)
80              strip out smart quotes and em dashes, etc.
81
82       -gdoc, -g (gdoc: yes)
83              produce clean version of html exported by Google Docs
84
85       -numeric, -n (numeric-entities: yes)
86              output numeric rather than named entities
87
88       -errors, -e (markup: no)
89              show only errors and warnings
90
91       -quiet, -q (quiet: yes)
92              suppress nonessential output
93
94       -omit (omit-optional-tags: yes)
95              omit optional start tags and end tags
96
97       -xml (input-xml: yes)
98              specify the input is well formed XML
99
100       -asxml, -asxhtml (output-xhtml: yes)
101              convert HTML to well formed XHTML
102
103       -ashtml (output-html: yes)
104              force XHTML to well formed HTML
105
106       -access <level> (accessibility-check: <level>)
107              do additional accessibility checks (<level> = 0, 1, 2, 3). 0 is
108              assumed if <level> is missing.
109
110   Character encodings
111       -raw   output values above 127 without conversion to entities
112
113       -ascii use ISO-8859-1 for input, US-ASCII for output
114
115       -latin0
116              use ISO-8859-15 for input, US-ASCII for output
117
118       -latin1
119              use ISO-8859-1 for both input and output
120
121       -iso2022
122              use ISO-2022 for both input and output
123
124       -utf8  use UTF-8 for both input and output
125
126       -mac   use MacRoman for input, US-ASCII for output
127
128       -win1252
129              use Windows-1252 for input, US-ASCII for output
130
131       -ibm858
132              use IBM-858 (CP850+Euro) for input, US-ASCII for output
133
134       -utf16le
135              use UTF-16LE for both input and output
136
137       -utf16be
138              use UTF-16BE for both input and output
139
140       -utf16 use UTF-16 for both input and output
141
142       -big5  use Big5 for both input and output
143
144       -shiftjis
145              use Shift_JIS for both input and output
146
147   Miscellaneous
148       -version, -v
149              show the version of Tidy
150
151       -help, -h, -?
152              list the command line options
153
154       -help-config
155              list all configuration options
156
157       -help-env
158              show information about the environment and runtime configuration
159
160       -show-config
161              list the current configuration settings
162
163       -export-config
164              list the current configuration settings, suitable for a config
165              file
166
167       -export-default-config
168              list the default configuration settings, suitable for a config
169              file
170
171       -help-option <option>
172              show a description of the <option>
173
174       -language <lang> (language: <lang>)
175              set Tidy's output language to <lang>. Specify '-language help'
176              for more help. Use before output-causing arguments to ensure the
177              language takes effect, e.g.,`tidy -lang es -lang help`.
178
179   XML
180       -xml-help
181              list the command line options in XML format
182
183       -xml-config
184              list all configuration options in XML format
185
186       -xml-strings
187              output all of Tidy's strings in XML format
188
189       -xml-error-strings
190              output error constants and strings in XML format
191
192       -xml-options-strings
193              output option descriptions in XML format
194
195   Configuration Options General
196
197       Configuration options can be specified by preceding each option with --
198       at the command line, followed by its desired value, OR by placing the
199       options and values in a configuration file, and telling tidy to read
200       that file with the -config option:
201
202          tidy --option1 value1 --option2 value2 ...
203          tidy -config config-file  ...
204
205       Configuration options can be conveniently grouped in a single config
206       file.  A Tidy configuration file is simply a text file, where each
207       option is listed on a separate line in the form
208
209          option1: value1
210          option2: value2
211          etc.
212
213       The permissible values for a given option depend on the option's Type.
214       There are five Types: Boolean, AutoBool, DocType, Enum, and String.
215       Boolean Types allow any of yes/no, y/n, true/false, t/f, 1/0.
216       AutoBools allow auto in addition to the values allowed by Booleans.
217       Integer Types take non-negative integers.  String Types generally have
218       no defaults, and you should provide them in non-quoted form (unless you
219       wish the output to contain the literal quotes).
220
221       Enum, Encoding, and DocType Types have a fixed repertoire of items,
222       which are listed in the Supported values sections below.
223
224       You only need to provide options and values for those whose defaults
225       you wish to override, although you may wish to include some already-
226       defaulted options and values for the sake of documentation and
227       explicitness.
228
229       Here is a sample config file, with at least one example of each of the
230       five Types:
231
232           // sample Tidy configuration options
233           output-xhtml: yes
234           add-xml-decl: no
235           doctype: strict
236           char-encoding: ascii
237           indent: auto
238           wrap: 76
239           repeated-attributes: keep-last
240           error-file: errs.txt
241
242       Below is a summary and brief description of each of the options.  They
243       are listed alphabetically within each category.
244
245   Document Display options
246
247       --gnu-emacs Boolean (no if unset)
248              This option specifies that Tidy should change the format for
249              reporting errors and warnings to a format that is more easily
250              parsed by GNU Emacs or some other program. It changes them from
251              the default
252
253               line <line number> column <column number> - (Error|Warning):
254              <message>
255
256              to a form which includes the input filename:
257
258               <filename>:<line number>:<column number>: (Error|Warning):
259              <message>
260
261              See also: --show-filename
262
263       --markup Boolean (yes if unset)
264              This option specifies if Tidy should generate a pretty printed
265              version of the markup. Note that Tidy won't generate a pretty
266              printed version if it finds significant errors (see force-
267              output).
268
269       --mute String
270              Use this option to prevent Tidy from displaying certain types of
271              report output, for example, for conditions that you wish to
272              ignore.
273
274              This option takes a list of one or more keys indicating the
275              message type to mute. You can discover these message keys by
276              using the mute-id configuration option and examining Tidy's
277              output.
278
279              See also: --mute-id
280
281       --mute-id Boolean (no if unset)
282              This option indicates whether or not Tidy should display message
283              ID's with each of its error reports. This could be useful if you
284              wanted to use the mute configuration option in order to filter
285              out certain report messages.
286
287              See also: --mute
288
289       --quiet Boolean (no if unset)
290              When enabled, this option limits Tidy's non-document output to
291              report only document warnings and errors.
292
293       --show-body-only Enum (no if unset)
294              Supported values: no, yes, auto
295
296              This option specifies if Tidy should print only the contents of
297              the body tag as an HTML fragment.
298
299              If set to auto, this is performed only if the body tag has been
300              inferred.
301
302              Useful for incorporating existing whole pages as a portion of
303              another page.
304
305              This option has no effect if XML output is requested.
306
307       --show-errors Integer (6 if unset)
308              This option specifies the number Tidy uses to determine if
309              further errors should be shown. If set to 0, then no errors are
310              shown.
311
312       --show-filename Boolean (no if unset)
313              This option specifies if Tidy should show the filename in
314              messages. eg:
315
316               tidy -q -e --show-filename yes index.html
317
318               index.html: line 43 column 3 - Warning: replacing invalid UTF-8
319              bytes (char. code U+00A9)
320
321              See also: --gnu-emacs
322
323       --show-info Boolean (yes if unset)
324              This option specifies if Tidy should display info-level
325              messages.
326
327       --show-warnings Boolean (yes if unset)
328              This option specifies if Tidy should suppress warnings. This can
329              be useful when a few errors are hidden in a flurry of warnings.
330
331   Document In and Out options
332
333       --add-meta-charset Boolean (no if unset)
334              This option, when enabled, adds a <meta> element and sets the
335              charset attribute to the encoding of the document. Set this
336              option to yes to enable it.
337
338       --add-xml-decl Boolean (no if unset)
339              This option specifies if Tidy should add the XML declaration
340              when outputting XML or XHTML.
341
342              Note that if the input already includes an <?xml ... ?>
343              declaration then this option will be ignored.
344
345              If the encoding for the output is different from ascii, one of
346              the utf* encodings, or raw, then the declaration is always added
347              as required by the XML standard.
348
349              See also: --char-encoding, --output-encoding
350
351       --add-xml-space Boolean (no if unset)
352              This option specifies if Tidy should add xml:space="preserve" to
353              elements such as <pre>, <style> and <script> when generating
354              XML.
355
356              This is needed if the whitespace in such elements is to be
357              parsed appropriately without having access to the DTD.
358
359       --doctype String (auto if unset)
360              This option specifies the DOCTYPE declaration generated by Tidy.
361
362              If set to omit the output won't contain a DOCTYPE declaration.
363              Note this this also implies numeric-entities is set to yes.
364
365              If set to html5 the DOCTYPE is set to <!DOCTYPE html>.
366
367              If set to auto (the default) Tidy will use an educated guess
368              based upon the contents of the document. Note that selecting
369              this option will not change the current document's DOCTYPE on
370              output.
371
372              If set to strict, Tidy will set the DOCTYPE to the HTML4 or
373              XHTML1 strict DTD.
374
375              If set to loose, the DOCTYPE is set to the HTML4 or XHTML1 loose
376              (transitional) DTD.
377
378              Alternatively, you can supply a string for the formal public
379              identifier (FPI).
380
381              For example:
382
383              doctype: "-//ACME//DTD HTML 3.14159//EN"
384
385              If you specify the FPI for an XHTML document, Tidy will set the
386              system identifier to an empty string. For an HTML document, Tidy
387              adds a system identifier only if one was already present in
388              order to preserve the processing mode of some browsers. Tidy
389              leaves the DOCTYPE for generic XML documents unchanged.
390
391              This option does not offer a validation of document conformance.
392
393       --input-xml Boolean (no if unset)
394              This option specifies if Tidy should use the XML parser rather
395              than the error correcting HTML parser.
396
397       --output-html Boolean (no if unset)
398              This option specifies if Tidy should generate pretty printed
399              output, writing it as HTML.
400
401       --output-xhtml Boolean (no if unset)
402              This option specifies if Tidy should generate pretty printed
403              output, writing it as extensible HTML.
404
405              This option causes Tidy to set the DOCTYPE and default namespace
406              as appropriate to XHTML, and will use the corrected value in
407              output regardless of other sources.
408
409              For XHTML, entities can be written as named or numeric entities
410              according to the setting of numeric-entities.
411
412              The original case of tags and attributes will be preserved,
413              regardless of other options.
414
415       --output-xml Boolean (no if unset)
416              This option specifies if Tidy should pretty print output,
417              writing it as well-formed XML.
418
419              Any entities not defined in XML 1.0 will be written as numeric
420              entities to allow them to be parsed by an XML parser.
421
422              The original case of tags and attributes will be preserved,
423              regardless of other options.
424
425   File Input-Output options
426
427       --error-file String
428              This option specifies the error file Tidy uses for errors and
429              warnings. Normally errors and warnings are output to stderr.
430
431              See also: --output-file
432
433       --keep-time Boolean (no if unset)
434              This option specifies if Tidy should keep the original
435              modification time of files that Tidy modifies in place.
436
437              Setting the option to yes allows you to tidy files without
438              changing the file modification date, which may be useful with
439              certain tools that use the modification date for things such as
440              automatic server deployment.
441
442              Note this feature is not supported on some platforms.
443
444       --output-file String
445              This option specifies the output file Tidy uses for markup.
446              Normally markup is written to stdout.
447
448              See also: --error-file
449
450       --write-back Boolean (no if unset)
451              This option specifies if Tidy should write back the tidied
452              markup to the same file it read from.
453
454              You are advised to keep copies of important files before tidying
455              them, as on rare occasions the result may not be what you
456              expect.
457
458   Diagnostics options
459
460       --accessibility-check Enum (0 (Tidy Classic) if unset)
461              Supported values: 0 (Tidy Classic), 1 (Priority 1 Checks), 2
462              (Priority 2 Checks), 3 (Priority 3 Checks)
463
464              This option specifies what level of accessibility checking, if
465              any, that Tidy should perform.
466
467              Level 0 (Tidy Classic) performs no additional accessibility
468              checking.
469
470              Level 1 (Priority 1 Checks) performs the Priority Level 1
471              checks.
472
473              Level 2 (Priority 2 Checks) performs the Priority Level 1 and 2
474              checks.
475
476              Level 3 (Priority 3 Checks) performs the Priority Level 1, 2,
477              and 3 checks.
478
479              For more information on Tidy's accessibility checking, including
480              the specific checks that are made for each Priority Level,
481              please visit Tidy's Accessibility Page at http://www.html-
482              tidy.org/accessibility/.
483
484       --force-output Boolean (no if unset)
485              This option specifies if Tidy should produce output even if
486              errors are encountered.
487
488              Use this option with care; if Tidy reports an error, this means
489              Tidy was not able to (or is not sure how to) fix the error, so
490              the resulting output may not reflect your intention.
491
492       --show-meta-change Boolean (no if unset)
493              This option enables a message whenever Tidy changes the content
494              attribute of a meta charset declaration to match the encoding of
495              the document. Set this option to yes to enable it.
496
497       --warn-proprietary-attributes Boolean (yes if unset)
498              This option specifies if Tidy should warn on proprietary
499              attributes.
500
501   Encoding options
502
503       --char-encoding Encoding (utf8 if unset)
504              Supported values: raw, ascii, latin0, latin1, utf8, iso2022,
505              mac, win1252, ibm858, utf16le, utf16be, utf16, big5, shiftjis
506
507              This option specifies the character encoding Tidy uses for
508              input, and when set, automatically chooses an appropriate
509              character encoding to be used for output. The output encoding
510              Tidy chooses may be different from the input encoding.
511
512              For ascii, latin0, ibm858, mac, and win1252 input encodings, the
513              output-encoding option will automatically be set to ascii. You
514              can set output-encoding manually to override this.
515
516              For other input encodings, the output-encoding option will
517              automatically be set to the the same value.
518
519              Regardless of the preset value, you can set output-encoding
520              manually to override this.
521
522              Tidy is not an encoding converter. Although the Latin and UTF
523              encodings can be mixed freely, it is not possible to convert
524              Asian encodings to Latin encodings with Tidy.
525
526              See also: --input-encoding, --output-encoding
527
528       --input-encoding Encoding (utf8 if unset)
529              Supported values: raw, ascii, latin0, latin1, utf8, iso2022,
530              mac, win1252, ibm858, utf16le, utf16be, utf16, big5, shiftjis
531
532              This option specifies the character encoding Tidy uses for
533              input. Tidy makes certain assumptions about some of the input
534              encodings.
535
536              For ascii, Tidy will accept Latin-1 (ISO-8859-1) character
537              values and convert them to entities as necessary.
538
539              For raw, Tidy will make no assumptions about the character
540              values and will pass them unchanged to output.
541
542              For mac and win1252, vendor specific characters values will be
543              accepted and converted to entities as necessary.
544
545              Asian encodings such as iso2022 will be handled appropriately
546              assuming the corresponding output-encoding is also specified.
547
548              Tidy is not an encoding converter. Although the Latin and UTF
549              encodings can be mixed freely, it is not possible to convert
550              Asian encodings to Latin encodings with Tidy.
551
552              See also: --char-encoding
553
554       --newline Enum (LF if unset)
555              Supported values: LF, CRLF, CR
556
557              The default is appropriate to the current platform.
558
559              Genrally CRLF on PC-DOS, Windows and OS/2; CR on Classic Mac OS;
560              and LF everywhere else (Linux, macOS, and Unix).
561
562       --output-bom Enum (auto if unset)
563              Supported values: no, yes, auto
564
565              This option specifies if Tidy should write a Unicode Byte Order
566              Mark character (BOM; also known as Zero Width No-Break Space;
567              has value of U+FEFF) to the beginning of the output, and only
568              applies to UTF-8 and UTF-16 output encodings.
569
570              If set to auto this option causes Tidy to write a BOM to the
571              output only if a BOM was present at the beginning of the input.
572
573              A BOM is always written for XML/XHTML output using UTF-16 output
574              encodings.
575
576       --output-encoding Encoding (utf8 if unset)
577              Supported values: raw, ascii, latin0, latin1, utf8, iso2022,
578              mac, win1252, ibm858, utf16le, utf16be, utf16, big5, shiftjis
579
580              This option specifies the character encoding Tidy uses for
581              output. Some of the output encodings affect whether or not some
582              characters are translated to entities, although in all cases,
583              some entities will be written according to other Tidy
584              configuration options.
585
586              For ascii, mac, and win1252 output encodings, entities will be
587              used for all characters with values over 127.
588
589              For raw output, Tidy will write values above 127 without
590              translating them to entities.
591
592              Output using latin1 will cause Tidy to write character values
593              higher than 255 as entities.
594
595              The UTF family such as utf8 will write output in the respective
596              UTF encoding.
597
598              Asian output encodings such as iso2022 will write output in the
599              specified encoding, assuming a corresponding input-encoding was
600              specified.
601
602              Tidy is not an encoding converter. Although the Latin and UTF
603              encodings can be mixed freely, it is not possible to convert
604              Asian encodings to Latin encodings with Tidy.
605
606              See also: --char-encoding
607
608   Cleanup options
609
610       --bare Boolean (no if unset)
611              This option specifies if Tidy should replace smart quotes and em
612              dashes with ASCII, and output spaces rather than non-breaking
613              spaces, where they exist in the input.
614
615       --clean Boolean (no if unset)
616              This option specifies if Tidy should perform cleaning of some
617              legacy presentational tags (currently <i>, <b>, <center> when
618              enclosed within appropriate inline tags, and <font>). If set to
619              yes, then the legacy tags will be replaced with CSS <style> tags
620              and structural markup as appropriate.
621
622       --drop-empty-elements Boolean (yes if unset)
623              This option specifies if Tidy should discard empty elements.
624
625       --drop-empty-paras Boolean (yes if unset)
626              This option specifies if Tidy should discard empty paragraphs.
627
628       --drop-proprietary-attributes Boolean (no if unset)
629              This option specifies if Tidy should strip out proprietary
630              attributes, such as Microsoft data binding attributes.
631              Additionally attributes that aren't permitted in the output
632              version of HTML will be dropped if used with strict-tags-
633              attributes.
634
635       --gdoc Boolean (no if unset)
636              This option specifies if Tidy should enable specific behavior
637              for cleaning up HTML exported from Google Docs.
638
639       --logical-emphasis Boolean (no if unset)
640              This option specifies if Tidy should replace any occurrence of
641              <i> with <em> and any occurrence of <b> with <strong>. Any
642              attributes are preserved unchanged.
643
644              This option can be set independently of the clean option.
645
646       --merge-divs Enum (auto if unset)
647              Supported values: no, yes, auto
648
649              This option can be used to modify the behavior of clean when set
650              to yes.
651
652              This option specifies if Tidy should merge nested <div> such as
653              <div><div>...</div></div>.
654
655              If set to auto the attributes of the inner <div> are moved to
656              the outer one. Nested <div> with id attributes are not merged.
657
658              If set to yes the attributes of the inner <div> are discarded
659              with the exception of class and style.
660
661              See also: --clean, --merge-spans
662
663       --merge-spans Enum (auto if unset)
664              Supported values: no, yes, auto
665
666              This option can be used to modify the behavior of clean when set
667              to yes.
668
669              This option specifies if Tidy should merge nested <span> such as
670              <span><span>...</span></span>.
671
672              The algorithm is identical to the one used by merge-divs.
673
674              See also: --clean, --merge-divs
675
676       --word-2000 Boolean (no if unset)
677              This option specifies if Tidy should go to great pains to strip
678              out all the surplus stuff Microsoft Word 2000 inserts when you
679              save Word documents as "Web pages". It doesn't handle embedded
680              images or VML.
681
682              You should consider saving using Word's Save As..., and choosing
683              Web Page, Filtered.
684
685   Entities options
686
687       --ascii-chars Boolean (no if unset)
688              Can be used to modify behavior of the clean option when set to
689              yes.
690
691              If set to yes when using clean, &emdash;, &rdquo;, and other
692              named character entities are downgraded to their closest ASCII
693              equivalents.
694
695              See also: --clean
696
697       --ncr Boolean (yes if unset)
698              This option specifies if Tidy should allow numeric character
699              references.
700
701       --numeric-entities Boolean (no if unset)
702              This option specifies if Tidy should output entities other than
703              the built-in HTML entities (&amp;, &lt;, &gt;, and &quot;) in
704              the numeric rather than the named entity form.
705
706              Only entities compatible with the DOCTYPE declaration generated
707              are used.
708
709              Entities that can be represented in the output encoding are
710              translated correspondingly.
711
712              See also: --doctype, --preserve-entities
713
714       --preserve-entities Boolean (no if unset)
715              This option specifies if Tidy should preserve well-formed
716              entities as found in the input.
717
718       --quote-ampersand Boolean (yes if unset)
719              This option specifies if Tidy should output unadorned &
720              characters as &amp;, in legacy doctypes only.
721
722       --quote-marks Boolean (no if unset)
723              This option specifies if Tidy should output " characters as
724              &quot; as is preferred by some editing environments.
725
726              The apostrophe character ' is written out as &#39; since many
727              web browsers don't yet support &apos;.
728
729       --quote-nbsp Boolean (yes if unset)
730              This option specifies if Tidy should output non-breaking space
731              characters as entities, rather than as the Unicode character
732              value 160 (decimal).
733
734   Repair options
735
736       --alt-text String
737              This option specifies the default alt= text Tidy uses for <img>
738              attributes when the alt= attribute is missing.
739
740              Use with care, as it is your responsibility to make your
741              documents accessible to people who cannot see the images.
742
743       --anchor-as-name Boolean (yes if unset)
744              This option controls the deletion or addition of the name
745              attribute in elements where it can serve as anchor.
746
747              If set to yes a name attribute, if not already existing, is
748              added along an existing id attribute if the DTD allows it.
749
750              If set to no any existing name attribute is removed if an id
751              attribute exists or has been added.
752
753       --assume-xml-procins Boolean (no if unset)
754              This option specifies if Tidy should change the parsing of
755              processing instructions to require ?> as the terminator rather
756              than >.
757
758              This option is automatically set if the input is in XML.
759
760       --coerce-endtags Boolean (yes if unset)
761              This option specifies if Tidy should coerce a start tag into an
762              end tag in cases where it looks like an end tag was probably
763              intended; for example, given
764
765              <span>foo <b>bar<b> baz</span>
766
767              Tidy will output
768
769              <span>foo <b>bar</b> baz</span>
770
771       --css-prefix String (c if unset)
772              This option specifies the prefix that Tidy uses for styles
773              rules.
774
775              By default, c will be used.
776
777       --custom-tags Enum (no if unset)
778              Supported values: no, blocklevel, empty, inline, pre
779
780              This option enables the use of tags for autonomous custom
781              elements, e.g. <flag-icon> with Tidy. Custom tags are disabled
782              if this value is no. Other settings - blocklevel, empty, inline,
783              and pre will treat all detected custom tags accordingly.
784
785              The use of new-blocklevel-tags, new-empty-tags, new-inline-tags,
786              or new-pre-tags will override the treatment of custom tags by
787              this configuration option. This may be useful if you have
788              different types of custom tags.
789
790              When enabled these tags are determined during the processing of
791              your document using opening tags; matching closing tags will be
792              recognized accordingly, and unknown closing tags will be
793              discarded.
794
795              See also: --new-blocklevel-tags, --new-empty-tags, --new-inline-
796              tags, --new-pre-tags
797
798       --enclose-block-text Boolean (no if unset)
799              This option specifies if Tidy should insert a <p> element to
800              enclose any text it finds in any element that allows mixed
801              content for HTML transitional but not HTML strict.
802
803       --enclose-text Boolean (no if unset)
804              This option specifies if Tidy should enclose any text it finds
805              in the body element within a <p> element.
806
807              This is useful when you want to take existing HTML and use it
808              with a style sheet.
809
810       --escape-scripts Boolean (yes if unset)
811              This option causes items that look like closing tags, like </g
812              to be escaped to <\/g. Set this option to no if you do not want
813              this.
814
815       --fix-backslash Boolean (yes if unset)
816              This option specifies if Tidy should replace backslash
817              characters \ in URLs with forward slashes /.
818
819       --fix-bad-comments Enum (auto if unset)
820              Supported values: no, yes, auto
821
822              This option specifies if Tidy should replace unexpected hyphens
823              with = characters when it comes across adjacent hyphens.
824
825              The default is auto will which will act as no for HTML5 document
826              types, and yes for all other document types.
827
828              HTML has abandoned SGML comment syntax, and allows adjacent
829              hyphens for all versions of HTML, although XML and XHTML do not.
830              If you plan to support older browsers that require SGML comment
831              syntax, then consider setting this value to yes.
832
833       --fix-style-tags Boolean (yes if unset)
834              This option specifies if Tidy should move all style tags to the
835              head of the document.
836
837       --fix-uri Boolean (yes if unset)
838              This option specifies if Tidy should check attribute values that
839              carry URIs for illegal characters and if such are found, escape
840              them as HTML4 recommends.
841
842       --literal-attributes Boolean (no if unset)
843              This option specifies how Tidy deals with whitespace characters
844              within attribute values.
845
846              If the value is no Tidy normalizes attribute values by replacing
847              any newline or tab with a single space, and further by replacing
848              any contiguous whitespace with a single space.
849
850              To force Tidy to preserve the original, literal values of all
851              attributes and ensure that whitespace within attribute values is
852              passed through unchanged, set this option to yes.
853
854       --lower-literals Boolean (yes if unset)
855              This option specifies if Tidy should convert the value of an
856              attribute that takes a list of predefined values to lower case.
857
858              This is required for XHTML documents.
859
860       --repeated-attributes Enum (keep-last if unset)
861              Supported values: keep-first, keep-last
862
863              This option specifies if Tidy should keep the first or last
864              attribute, if an attribute is repeated, e.g. has two align
865              attributes.
866
867              See also: --join-classes, --join-styles
868
869       --skip-nested Boolean (yes if unset)
870              This option specifies that Tidy should skip nested tags when
871              parsing script and style data.
872
873       --strict-tags-attributes Boolean (no if unset)
874              This options ensures that tags and attributes are applicable for
875              the version of HTML that Tidy outputs. When set to yes and the
876              output document type is a strict doctype, then Tidy will report
877              errors. If the output document type is a loose or transitional
878              doctype, then Tidy will report warnings.
879
880              Additionally if drop-proprietary-attributes is enabled, then not
881              applicable attributes will be dropped, too.
882
883              When set to no, these checks are not performed.
884
885       --uppercase-attributes Enum (no if unset)
886              Supported values: no, yes, preserve
887
888              This option specifies if Tidy should output attribute names in
889              upper case.
890
891              When set to no, attribute names will be written in lower case.
892              Specifying yes will output attribute names in upper case, and
893              preserve can used to leave attribute names untouched.
894
895              When using XML input, the original case is always preserved.
896
897       --uppercase-tags Boolean (no if unset)
898              This option specifies if Tidy should output tag names in upper
899              case.
900
901              The default is no which results in lower case tag names, except
902              for XML input where the original case is preserved.
903
904   Transformation options
905
906       --decorate-inferred-ul Boolean (no if unset)
907              This option specifies if Tidy should decorate inferred <ul>
908              elements with some CSS markup to avoid indentation to the right.
909
910       --escape-cdata Boolean (no if unset)
911              This option specifies if Tidy should convert <![CDATA[]]>
912              sections to normal text.
913
914       --hide-comments Boolean (no if unset)
915              This option specifies if Tidy should not print out comments.
916
917       --join-classes Boolean (no if unset)
918              This option specifies if Tidy should combine class names to
919              generate a single, new class name if multiple class assignments
920              are detected on an element.
921
922       --join-styles Boolean (yes if unset)
923              This option specifies if Tidy should combine styles to generate
924              a single, new style if multiple style values are detected on an
925              element.
926
927       --merge-emphasis Boolean (yes if unset)
928              This option specifies if Tidy should merge nested <b> and <i>
929              elements; for example, for the case
930
931              <b class="rtop-2">foo <b class="r2-2">bar</b> baz</b>,
932
933              Tidy will output <b class="rtop-2">foo bar baz</b>.
934
935       --replace-color Boolean (no if unset)
936              This option specifies if Tidy should replace numeric values in
937              color attributes with HTML/XHTML color names where defined, e.g.
938              replace #ffffff with white.
939
940   Teaching Tidy options
941
942       --new-blocklevel-tags Tag Names
943              Supported values: tagX, tagY, ...
944
945              This option specifies new block-level tags. This option takes a
946              space or comma separated list of tag names.
947
948              Unless you declare new tags, Tidy will refuse to generate a
949              tidied file if the input includes previously unknown tags.
950
951              Note you can't change the content model for elements such as
952              <table>, <ul>, <ol> and <dl>.
953
954              This option is ignored in XML mode.
955
956              See also: --new-empty-tags, --new-inline-tags, --new-pre-tags,
957              --custom-tags
958
959       --new-empty-tags Tag Names
960              Supported values: tagX, tagY, ...
961
962              This option specifies new empty inline tags. This option takes a
963              space or comma separated list of tag names.
964
965              Unless you declare new tags, Tidy will refuse to generate a
966              tidied file if the input includes previously unknown tags.
967
968              Remember to also declare empty tags as either inline or
969              blocklevel.
970
971              This option is ignored in XML mode.
972
973              See also: --new-blocklevel-tags, --new-inline-tags, --new-pre-
974              tags, --custom-tags
975
976       --new-inline-tags Tag Names
977              Supported values: tagX, tagY, ...
978
979              This option specifies new non-empty inline tags. This option
980              takes a space or comma separated list of tag names.
981
982              Unless you declare new tags, Tidy will refuse to generate a
983              tidied file if the input includes previously unknown tags.
984
985              This option is ignored in XML mode.
986
987              See also: --new-blocklevel-tags, --new-empty-tags, --new-pre-
988              tags, --custom-tags
989
990       --new-pre-tags Tag Names
991              Supported values: tagX, tagY, ...
992
993              This option specifies new tags that are to be processed in
994              exactly the same way as HTML's <pre> element. This option takes
995              a space or comma separated list of tag names.
996
997              Unless you declare new tags, Tidy will refuse to generate a
998              tidied file if the input includes previously unknown tags.
999
1000              Note you cannot as yet add new CDATA elements.
1001
1002              This option is ignored in XML mode.
1003
1004              See also: --new-blocklevel-tags, --new-empty-tags, --new-inline-
1005              tags, --custom-tags
1006
1007   Pretty Print options
1008
1009       --break-before-br Boolean (no if unset)
1010              This option specifies if Tidy should output a line break before
1011              each <br> element.
1012
1013       --indent Enum (no if unset)
1014              Supported values: no, yes, auto
1015
1016              This option specifies if Tidy should indent block-level tags.
1017
1018              If set to auto Tidy will decide whether or not to indent the
1019              content of tags such as <title>, <h1>-<h6>, <li>, <td>, or <p>
1020              based on the content including a block-level element.
1021
1022              Setting indent to yes can expose layout bugs in some browsers.
1023
1024              Use the option indent-spaces to control the number of spaces or
1025              tabs output per level of indent, and indent-with-tabs to specify
1026              whether spaces or tabs are used.
1027
1028              See also: --indent-spaces
1029
1030       --indent-attributes Boolean (no if unset)
1031              This option specifies if Tidy should begin each attribute on a
1032              new line.
1033
1034       --indent-cdata Boolean (no if unset)
1035              This option specifies if Tidy should indent <![CDATA[]]>
1036              sections.
1037
1038       --indent-spaces Integer (2 if unset)
1039              This option specifies the number of spaces or tabs that Tidy
1040              uses to indent content when indent is enabled.
1041
1042              Note that the default value for this option is dependent upon
1043              the value of indent-with-tabs (see also).
1044
1045              See also: --indent
1046
1047       --indent-with-tabs Boolean (no if unset)
1048              This option specifies if Tidy should indent with tabs instead of
1049              spaces, assuming indent is yes.
1050
1051              Set it to yes to indent using tabs instead of the default
1052              spaces.
1053
1054              Use the option indent-spaces to control the number of tabs
1055              output per level of indent. Note that when indent-with-tabs is
1056              enabled the default value of indent-spaces is reset to 1.
1057
1058              Note tab-size controls converting input tabs to spaces. Set it
1059              to zero to retain input tabs.
1060
1061       --keep-tabs Boolean (no if unset)
1062              With the default no Tidy will replace all source tabs with
1063              spaces, controlled by the option tab-size, and the current line
1064              offset. Of course, except in the special blocks/elements
1065              enumerated below, this will later be reduced to just one space.
1066
1067              If set yes this option specifies Tidy should keep certain tabs
1068              found in the source, but only in preformatted blocks like <pre>,
1069              and other CDATA elements like <script>, <style>, and other
1070              pseudo elements like <?php ... ?>. As always, all other tabs, or
1071              sequences of tabs, in the source will continue to be replaced
1072              with a space.
1073
1074       --omit-optional-tags Boolean (no if unset)
1075              This option specifies if Tidy should omit optional start tags
1076              and end tags when generating output.
1077
1078              Setting this option causes all tags for the <html>, <head>, and
1079              <body> elements to be omitted from output, as well as such end
1080              tags as </p>, </li>, </dt>, </dd>, </option>, </tr>, </td>, and
1081              </th>.
1082
1083              This option is ignored for XML output.
1084
1085       --priority-attributes Attributes Names
1086              Supported values: attributeX, attributeY, ...
1087
1088              This option allows prioritizing the writing of attributes in
1089              tidied documents, allowing them to written before the other
1090              attributes of an element. For example, you might specify that id
1091              and name are written before every other attribute.
1092
1093              This option takes a space or comma separated list of attribute
1094              names.
1095
1096       --punctuation-wrap Boolean (no if unset)
1097              This option specifies if Tidy should line wrap after some
1098              Unicode or Chinese punctuation characters.
1099
1100       --sort-attributes Enum (none if unset)
1101              Supported values: none, alpha
1102
1103              This option specifies that Tidy should sort attributes within an
1104              element using the specified sort algorithm. If set to alpha, the
1105              algorithm is an ascending alphabetic sort.
1106
1107              When used while sorting with priority-attributes, any attribute
1108              sorting will take place after the priority attributes have been
1109              output.
1110
1111              See also: --priority-attributes
1112
1113       --tab-size Integer (8 if unset)
1114              This option specifies the number of columns that Tidy uses
1115              between successive tab stops. It is used to map tabs to spaces
1116              when reading the input.
1117
1118       --tidy-mark Boolean (yes if unset)
1119              This option specifies if Tidy should add a meta element to the
1120              document head to indicate that the document has been tidied.
1121
1122              Tidy won't add a meta element if one is already present.
1123
1124       --vertical-space Enum (no if unset)
1125              Supported values: no, yes, auto
1126
1127              This option specifies if Tidy should add some extra empty lines
1128              for readability.
1129
1130              The default is no.
1131
1132              If set to auto Tidy will eliminate nearly all newline
1133              characters.
1134
1135       --wrap Integer (68 if unset)
1136              This option specifies the right margin Tidy uses for line
1137              wrapping.
1138
1139              Tidy tries to wrap lines so that they do not exceed this length.
1140
1141              Set wrap to 0 (zero) if you want to disable line wrapping.
1142
1143       --wrap-asp Boolean (yes if unset)
1144              This option specifies if Tidy should line wrap text contained
1145              within ASP pseudo elements, which look like: <% ... %>.
1146
1147       --wrap-attributes Boolean (no if unset)
1148              This option specifies if Tidy should line-wrap attribute values,
1149              meaning that if the value of an attribute causes a line to
1150              exceed the width specified by wrap, Tidy will add one or more
1151              line breaks to the value, causing it to be wrapped into multiple
1152              lines.
1153
1154              Note that this option can be set independently of wrap-script-
1155              literals. By default Tidy replaces any newline or tab with a
1156              single space and replaces any sequences of whitespace with a
1157              single space.
1158
1159              To force Tidy to preserve the original, literal values of all
1160              attributes, and ensure that whitespace characters within
1161              attribute values are passed through unchanged, set literal-
1162              attributes to yes.
1163
1164              See also: --wrap-script-literals, --literal-attributes
1165
1166       --wrap-jste Boolean (yes if unset)
1167              This option specifies if Tidy should line wrap text contained
1168              within JSTE pseudo elements, which look like: <# ... #>.
1169
1170       --wrap-php Boolean (no if unset)
1171              This option specifies if Tidy should add a new line after a PHP
1172              pseudo elements, which look like: <?php ... ?>.
1173
1174       --wrap-script-literals Boolean (no if unset)
1175              This option specifies if Tidy should line wrap string literals
1176              assigned to element event handler attributes, such as
1177              element.onmouseover().
1178
1179              See also: --wrap-attributes
1180
1181       --wrap-sections Boolean (yes if unset)
1182              This option specifies if Tidy should line wrap text contained
1183              within <![ ... ]> section tags.
1184

ENVIRONMENT

1186       HTML_TIDY
1187              Name of the default configuration file.  This should be an
1188              absolute path, since you will probably invoke tidy from
1189              different directories.  The value of HTML_TIDY will be parsed
1190              after the compiled-in default (defined with -DTIDY_CONFIG_FILE),
1191              but before any of the files specified using -config.
1192
1193
1194       RUNTIME CONFIGURATION FILES
1195              You can also specify runtime configuration files from which tidy
1196              will attempt to load a configuration automatically.
1197
1198              The system runtime configuration file (/etc/tidy.conf), if it
1199              exists will be loaded and applied first, followed by the user
1200              runtime configuration file (~/.tidyrc).  Subsequent usage of a
1201              specific option will override any previous usage.
1202
1203              Note that if you use the HTML_TIDY environment variable, then
1204              the user runtime configuration file will not be used. This is a
1205              feature, not a bug.
1206
1207

EXIT STATUS

1209       0      All input files were processed successfully.
1210
1211       1      There were warnings.
1212
1213       2      There were errors.
1214
1215

SEE ALSO

1217       For more information about HTML Tidy:
1218
1219           http://www.html-tidy.org/
1220
1221       For more information on HTML:
1222
1223           HTML: Edition for Web Authors (the latest HTML specification)
1224           http://dev.w3.org/html5/spec-author-view
1225
1226           HTML: The Markup Language (an HTML language reference)
1227           http://dev.w3.org/html5/markup/
1228
1229       For bug reports and comments:
1230
1231           https://github.com/htacg/tidy-html5/issues/
1232
1233       Or send questions and comments to public-htacg@w3.org.
1234
1235       Validate your HTML documents using the W3C Nu Markup Validator:
1236
1237           http://validator.w3.org/nu/
1238

AUTHOR

1240       Tidy was written by Dave Raggett <dsr@w3.org>, and subsequently
1241       maintained by a team at http://tidy.sourceforge.net/, and now
1242       maintained by HTACG (http://www.htacg.org).
1243
1244       The sources for HTML Tidy are available at
1245       https://github.com/htacg/tidy-html5/ under the MIT Licence.
1246
1247
1248
1249HTML Tidy                            5.8.0                             TIDY(1)
Impressum