如何在结束标记之前获得HTML Tidy以不放置换行符? [英] How do I get HTML Tidy to not put newline before closing tags?

查看:124
本文介绍了如何在结束标记之前获得HTML Tidy以不放置换行符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HTML Tidy有这样一种恼人的习惯:在结束标记之前放置一个换行符。例如:

 < p>一些文字< / p> 

变为

 < p>一些文字
< / p>

如何让Tidy将结束标记保留在内容末尾的同一行上?



顺便说一句,我通过Notepad ++运行Tidy,如果这有什么区别的话。

请确保 vertical-space 设置为 no 。我经历了许多挫折之后,才知道开关所做的唯一事情就是通过在不需要它们的地方添加换行符,将已经格式化很好的html搞砸了。



这是我用于微创整理(无需添加文档类型/头标签等):

tidy -mqi --doctype omit - 仅显示正文 - 显示true - 显示警告no - 垂直空格no - 包装0


HTML Tidy has this infuriating habit of putting a newline before the closing tag. For example:

<p>Some text</p>

becomes

<p>Some text
</p>

How do I tell Tidy to keep the closing tag on the same line as the end of the content?

Btw, I am running Tidy through Notepad++, if that makes any difference.

解决方案

Make sure vertical-space is set to no. After much frustration I learned the only thing that switch does is screw up your already somewhat-nicely formatted html by adding newlines where you don't want them.

This is what I use for minimally-invasive tidying (no adding doctypes/head tags, etc.):

tidy -mqi --doctype omit --show-body-only true --show-warnings no --vertical-space no --wrap 0

这篇关于如何在结束标记之前获得HTML Tidy以不放置换行符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆