我要缩进
<!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>
到
<!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>
与tidy -config config.txt -m index.html
。
config.txt
看起来像
doctype: html5
indent: auto
indent-spaces: 4
wrap: 0
tab-size: 4
quiet: yes
show-warnings: no
tidy-mark: no
版本为:HTML Tidy for Apple macOS version 5.6.0
我浏览了HTML Tidy 5.7.0 Options Quick Reference并尝试了一些尝试,但没有成功。
缺少什么?
答案 0 :(得分:0)
“问题”是您的选择onDeviceReady
。在man pages中,您可以阅读:
indent: auto
将If set to auto Tidy will decide whether or not to indent the content of tags such
as <title>, <h1>-<h6>, <li>, <td>, or <p> based on the content including a block-
level element.
设置为indent
时,您的yes
和<head>
部分将缩进,但所有列表项也将缩进,
<body>
仅供参考:您无需将<!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>
的所有选项都写入配置文件中,还可以通过在每个选项前面加上tidy
并以空格分隔的值来将它们作为选项传递。产生以上输出的最小命令是:
--
在某些情况下可能有用。