htmlsublimetext3sublimetexthtmltidy

HTML Tidy command-line syntax?


Why doesn't this work with HTML Tidy?

tidy index.html --uppercase-attributes yes

(I got the list of available config options from tidy -help-config command.)

If I put invalid option there, I get an error, which is good. But if I put a correct option, like the one above, it feels like it's just ignored. The output is always the same and the warnings are the same as well.

I'm trying to use HTML Tidy with Sublime Text 3. I don't expect it to take config with Sublime Text if it doesn't even work from the console.

Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>HTML Tidy</title>
</head>
<body>
    <input TYPE="text" name="foo">
</body>
</html>

As you can see, I have an input with one attribute lowercased and one attribute uppercased. No matter what I do with --uppercase-attributes option, the output is always:

Info: Document content looks like HTML5
No warnings or errors were found.

<!DOCTYPE html>
<html lang="en">
<head>
<meta name="generator" content=
"HTML Tidy for HTML5 for Apple macOS version 5.6.0">
<meta charset="utf-8">
<title>HTML Tidy</title>
</head>
<body>
<input type="text" name="foo">
</body>
</html>

What am I doing wrong? I'm using HTML Tidy 5.6.0 on macOS High Sierra.


Solution

  • Okay, I found the answer myself.

    Configuration options should go before the name of the file, so instead of this:

    tidy index.html --uppercase-attributes yes
    

    It should be this:

    tidy --uppercase-attributes yes index.html
    

    Not sure why there is no warning or anything though.