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