html tidy (html 格式化)

配置文件:
 
bare: yes               # remove proprietary HTML
 
doctype: auto           # set the doctype
 
drop-empty-paras: yes   # automatically delete empty <p> tags
 
fix-backslash: yes      # replace by / in URLs
 
literal-attributes: yes # retain whitespace in attribute values
 
lower-literals: yes     # convert attribute values to lower case
 
output-xhtml: yes       # produce valid XHTML output
 
quote-ampersand: yes    # replace & with &amp;
 
quote-marks: yes        # replace " with &quot;
 
repeated-attributes: keep-last  # use the last of duplicated attributes
 
indent: yes             # automatically indent code
 
indent-spaces: 2        # number of spaces to indent by
 
wrap-php: no            # wrap text contained in PHP tags
 
char-encoding: utf8    # character encoding to use
 
tidy-mark: no           # omit Tidy meta information in corrected code
 
wrap: 200              # wrap text at column 72 (default is 68)
 
把上述配置保存到文件config.txt 中
 
应用:
./tidy -config config.txt < 输入.html > 输出.html
 
相关文章:
 

猜你喜欢

转载自blog.csdn.net/pf070811/article/details/2106813
今日推荐