Tidy

The granddaddy of HTML tools, with support for modern standards.

Version

5.2.0

Runtime

Alpine Linux 3.6

Supported Languages

HTML

Official Documentation

http://www.html-tidy.org

YAML Configuration

tidy:

  • input:

    Patterns to include in execution and reports.

  • ignore:

    Patterns to exclude from execution and reports.

  • auto-fix:

    true/false

    Specifying true implies -modify option.

  • config-file:

    Alias of -config option.

  • machine:

    • cpu:

      Amount of CPU. The default machine has 0.25 CPU with 960 MiB RAM.

  • options:

    Below is the list of options that are supported:

    File manipulation
    -----------------
     -config <file>            set configuration options from the specified <file>
    
    Processing directives
    ---------------------
     -indent, -i               indent element content
     -wrap <column>, -w        wrap text at the specified <column>. 0 is assumed if
     <column>                  <column> is missing. When this option is omitted,
                               the default of the configuration option 'wrap'
                               applies.
     -upper, -u                force tags to upper case
     -clean, -c                replace FONT, NOBR and CENTER tags with CSS
     -bare, -b                 strip out smart quotes and em dashes, etc.
     -numeric, -n              output numeric rather than named entities
     -errors, -e               show only errors and warnings
     -omit                     omit optional start tags and end tags
     -asxml, -asxhtml          convert HTML to well formed XHTML
     -ashtml                   force XHTML to well formed HTML
     -access <level>           do additional accessibility checks (<level> = 0, 1,
                               2, 3). 0 is assumed if <level> is missing.
    
    Character encodings
    -------------------
     -raw                      output values above 127 without conversion to
                               entities
     -ascii                    use ISO-8859-1 for input, US-ASCII for output
     -latin0                   use ISO-8859-15 for input, US-ASCII for output
     -latin1                   use ISO-8859-1 for both input and output
     -iso2022                  use ISO-2022 for both input and output
     -utf8                     use UTF-8 for both input and output
     -mac                      use MacRoman for input, US-ASCII for output
     -win1252                  use Windows-1252 for input, US-ASCII for output
     -ibm858                   use IBM-858 (CP850+Euro) for input, US-ASCII for
                               output
     -utf16le                  use UTF-16LE for both input and output
     -utf16be                  use UTF-16BE for both input and output
     -utf16                    use UTF-16 for both input and output
     -big5                     use Big5 for both input and output
     -shiftjis                 use Shift_JIS for both input and output

    You can also set config options on the command line by preceding the name of the option immediately (no intervening space) with the string “--”:

    Name                        Type       Allowable values
    =========================== =========  ========================================
    accessibility-check         enum       0 (Tidy Classic), 1 (Priority 1 Checks),
                                           2 (Priority 2 Checks), 3 (Priority 3
                                           Checks)
    add-xml-decl                Boolean    y/n, yes/no, t/f, true/false, 1/0
    add-xml-space               Boolean    y/n, yes/no, t/f, true/false, 1/0
    alt-text                    String     -
    anchor-as-name              Boolean    y/n, yes/no, t/f, true/false, 1/0
    ascii-chars                 Boolean    y/n, yes/no, t/f, true/false, 1/0
    assume-xml-procins          Boolean    y/n, yes/no, t/f, true/false, 1/0
    bare                        Boolean    y/n, yes/no, t/f, true/false, 1/0
    break-before-br             Boolean    y/n, yes/no, t/f, true/false, 1/0
    char-encoding               Encoding   raw, ascii, latin0, latin1, utf8,
                                           iso2022, mac, win1252, ibm858, utf16le,
                                           utf16be, utf16, big5, shiftjis
    clean                       Boolean    y/n, yes/no, t/f, true/false, 1/0
    coerce-endtags              Boolean    y/n, yes/no, t/f, true/false, 1/0
    css-prefix                  String     -
    decorate-inferred-ul        Boolean    y/n, yes/no, t/f, true/false, 1/0
    doctype                     DocType    html5, omit, auto, strict, transitional,
                                           user
    drop-empty-elements         Boolean    y/n, yes/no, t/f, true/false, 1/0
    drop-empty-paras            Boolean    y/n, yes/no, t/f, true/false, 1/0
    drop-font-tags              Boolean    y/n, yes/no, t/f, true/false, 1/0
    drop-proprietary-attributes Boolean    y/n, yes/no, t/f, true/false, 1/0
    enclose-block-text          Boolean    y/n, yes/no, t/f, true/false, 1/0
    enclose-text                Boolean    y/n, yes/no, t/f, true/false, 1/0
    escape-cdata                Boolean    y/n, yes/no, t/f, true/false, 1/0
    escape-scripts              Boolean    y/n, yes/no, t/f, true/false, 1/0
    fix-backslash               Boolean    y/n, yes/no, t/f, true/false, 1/0
    fix-bad-comments            Boolean    y/n, yes/no, t/f, true/false, 1/0
    fix-uri                     Boolean    y/n, yes/no, t/f, true/false, 1/0
    force-output                Boolean    y/n, yes/no, t/f, true/false, 1/0
    gdoc                        Boolean    y/n, yes/no, t/f, true/false, 1/0
    hide-comments               Boolean    y/n, yes/no, t/f, true/false, 1/0
    hide-endtags                Boolean    y/n, yes/no, t/f, true/false, 1/0
    indent                      AutoBool   auto, y/n, yes/no, t/f, true/false, 1/0
    indent-attributes           Boolean    y/n, yes/no, t/f, true/false, 1/0
    indent-cdata                Boolean    y/n, yes/no, t/f, true/false, 1/0
    indent-spaces               Integer    0, 1, 2, ...
    indent-with-tabs            Boolean    y/n, yes/no, t/f, true/false, 1/0
    input-encoding              Encoding   raw, ascii, latin0, latin1, utf8,
                                           iso2022, mac, win1252, ibm858, utf16le,
                                           utf16be, utf16, big5, shiftjis
    input-xml                   Boolean    y/n, yes/no, t/f, true/false, 1/0
    join-classes                Boolean    y/n, yes/no, t/f, true/false, 1/0
    join-styles                 Boolean    y/n, yes/no, t/f, true/false, 1/0
    keep-time                   Boolean    y/n, yes/no, t/f, true/false, 1/0
    literal-attributes          Boolean    y/n, yes/no, t/f, true/false, 1/0
    logical-emphasis            Boolean    y/n, yes/no, t/f, true/false, 1/0
    lower-literals              Boolean    y/n, yes/no, t/f, true/false, 1/0
    markup                      Boolean    y/n, yes/no, t/f, true/false, 1/0
    merge-divs                  AutoBool   auto, y/n, yes/no, t/f, true/false, 1/0
    merge-emphasis              Boolean    y/n, yes/no, t/f, true/false, 1/0
    merge-spans                 AutoBool   auto, y/n, yes/no, t/f, true/false, 1/0
    ncr                         Boolean    y/n, yes/no, t/f, true/false, 1/0
    new-blocklevel-tags         Tag names  tagX, tagY, ...
    new-empty-tags              Tag names  tagX, tagY, ...
    new-inline-tags             Tag names  tagX, tagY, ...
    new-pre-tags                Tag names  tagX, tagY, ...
    newline                     enum       LF, CRLF, CR
    numeric-entities            Boolean    y/n, yes/no, t/f, true/false, 1/0
    omit-optional-tags          Boolean    y/n, yes/no, t/f, true/false, 1/0
    output-bom                  AutoBool   auto, y/n, yes/no, t/f, true/false, 1/0
    output-encoding             Encoding   raw, ascii, latin0, latin1, utf8,
                                           iso2022, mac, win1252, ibm858, utf16le,
                                           utf16be, utf16, big5, shiftjis
    output-html                 Boolean    y/n, yes/no, t/f, true/false, 1/0
    output-xhtml                Boolean    y/n, yes/no, t/f, true/false, 1/0
    output-xml                  Boolean    y/n, yes/no, t/f, true/false, 1/0
    preserve-entities           Boolean    y/n, yes/no, t/f, true/false, 1/0
    punctuation-wrap            Boolean    y/n, yes/no, t/f, true/false, 1/0
    quote-ampersand             Boolean    y/n, yes/no, t/f, true/false, 1/0
    quote-marks                 Boolean    y/n, yes/no, t/f, true/false, 1/0
    quote-nbsp                  Boolean    y/n, yes/no, t/f, true/false, 1/0
    repeated-attributes         enum       keep-first, keep-last
    replace-color               Boolean    y/n, yes/no, t/f, true/false, 1/0
    show-body-only              AutoBool   auto, y/n, yes/no, t/f, true/false, 1/0
    show-errors                 Integer    0, 1, 2, ...
    show-info                   Boolean    y/n, yes/no, t/f, true/false, 1/0
    show-warnings               Boolean    y/n, yes/no, t/f, true/false, 1/0
    skip-nested                 Boolean    y/n, yes/no, t/f, true/false, 1/0
    slide-style                 String     -
    sort-attributes             enum       none, alpha
    split                       Boolean    y/n, yes/no, t/f, true/false, 1/0
    strict-tags-attributes      Boolean    y/n, yes/no, t/f, true/false, 1/0
    tab-size                    Integer    0, 1, 2, ...
    tidy-mark                   Boolean    y/n, yes/no, t/f, true/false, 1/0
    uppercase-attributes        Boolean    y/n, yes/no, t/f, true/false, 1/0
    uppercase-tags              Boolean    y/n, yes/no, t/f, true/false, 1/0
    vertical-space              AutoBool   auto, y/n, yes/no, t/f, true/false, 1/0
    word-2000                   Boolean    y/n, yes/no, t/f, true/false, 1/0
    wrap                        Integer    0 (no wrapping), 1, 2, ...
    wrap-asp                    Boolean    y/n, yes/no, t/f, true/false, 1/0
    wrap-attributes             Boolean    y/n, yes/no, t/f, true/false, 1/0
    wrap-jste                   Boolean    y/n, yes/no, t/f, true/false, 1/0
    wrap-php                    Boolean    y/n, yes/no, t/f, true/false, 1/0
    wrap-script-literals        Boolean    y/n, yes/no, t/f, true/false, 1/0
    wrap-sections               Boolean    y/n, yes/no, t/f, true/false, 1/0
    write-back                  Boolean    y/n, yes/no, t/f, true/false, 1/0
  • experimental:

    • incremental:

      true/false

      Note: The incremental analysis is disabled if any kinds of configuration files are changed. The files recognized as configuration files are as follows:

      • Configuration files:
        • Files specified in config-file field
        • Files specified to -config option
        • If none of the above configuration files are found:
          • **/tidy.config, **/.tidyrc

YAML Examples

  • With default options:

    inspecode:
      tidy: default
  • With enabling auto-fixing and default options:

    inspecode:
      tidy: auto-fix
  • With custom machine:

    inspecode:
      tidy:
        machine:
          cpu: 1.5 # 1.5 CPU, 5760 MiB RAM
  • With custom options:

    inspecode:
      tidy:
        options:
          --wrap: 72
          --indent: no
  • With a configuration file:

    inspecode:
      tidy:
        config-file: ./my-tidy.conf

    The above configuration is equivalent to:

    inspecode:
      tidy:
        options:
          -config: ./my-tidy.conf

Configuration File Detection

If no configuration files are specified via config-file or options field, Inspecode walks the file tree in lexical order in your repository to find a configuration file named tidy.config or .tidyrc and specifies the file first found to Tidy automatically via -config option.

Note: Inspecode ignores specific configuration files while searching. See Configuration > Tool Configuration > Field: config-file for detail.

If the configuration file detected by Inspecode is not the one you want to use or you do not want to use any configuration files, you can disable Inspecode from detecting configuration files by explicitly setting an empty string to config-file field like below:

inspecode:
  tidy:
    config-file: ""

results matching ""

    No results matching ""