I want to indent
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul>
<li>List 1</li>
<li>List 2</li>
<li>List 3</li>
<li>List 4</li>
<li>List 5</li>
</ul>
</body>
</html>
to
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<ul>
<li>List 1</li>
<li>List 2</li>
<li>List 3</li>
<li>List 4</li>
<li>List 5</li>
</ul>
</body>
</html>
with tidy -config config.txt -m index.html.
The config.txt looks like
doctype: html5
indent: auto
indent-spaces: 4
wrap: 0
tab-size: 4
quiet: yes
show-warnings: no
tidy-mark: no
The version is: HTML Tidy for Apple macOS version 5.6.0
I skimmed through HTML Tidy 5.7.0 Options Quick Reference and tried a few things, but without success.
What is missing?
The "problem" is your option
indent: auto. In the man pages, you can read:When you set
indenttoyes, your<head>and<body>sections will be indented, but also all list items, which you might not like:FYI: Instead of writing all options for
tidyinto a config file, you can also pass them as options by prefixing each option with--and adding the value separated by space. The minimal command to produce the above output is:Might be usefull in some cases.