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