html tidy删除空标签,例如< i class ='icon-foo'></i> [英] html tidy removes empty tags, such as <i class='icon-foo'></i>

查看:140
本文介绍了html tidy删除空标签,例如< i class ='icon-foo'></i>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的文档中包含很多超棒的字体图标,这些图标是使用<i class='icon-somename'></i>嵌入的.一个空的i标签... HTML Tidy删除它们.我已将drop-empty-paras设置为false,但仍会删除该标签. 文档对于解决此问题没有任何帮助,也许有人知道吗?

I have documents with lots of font-awesome icons in them, which are embedded using <i class='icon-somename'></i>. An empty i tag... HTML Tidy removes them. I've set drop-empty-paras to false, but it still removes this tag. The documentation has not been of any help in resolving the matter, perhaps someone here knows?

我认为必须通过在标签内添加内容来破坏我的所有图标是荒谬的,以便可以运行整洁然后再删除所有内容.但是到目前为止,这是我发现的唯一建议.

I think it's absurd to have to break all my icons by adding content inside the tag just so tidy can be run then remove all the content again afterwards. But so far that has been the only suggestion I've found.

推荐答案

在Notapad ++的Tidy2插件中,我遇到了同样的问题.它正在删除一些仅带有引导类的空标签,例如<span class="caret"></span>.我通过在配置文件中使用drop-empty-elements: no对其进行了修复.

I had the same problem in the Tidy2 plugin for Notapad++. It was removing some empty tags that had nothing but a bootstrap class on them, like <span class="caret"></span>. I fixed it by using drop-empty-elements: no in the config file.

这是一个古老的问题,您链接到的文档没有显示该选项有效,因此您可能使用的是原始的Tidy,并且该选项已添加到Tidy2中.

This is an old question, and the documentation you linked to doesn't show that option as being valid, so probably you were using original Tidy and the option was added in Tidy2.

就算了,因为我的最初搜索将我带到了这里,并且我没有在这篇文章中找到答案,而不得不自己弄清楚,也许这个答案会对其他人有所帮助,即使为时已晚无法帮助OP

Just figured, since my initial search landed me here, and I didn't find the answer on this post and had to figure it out myself, maybe this answer will help someone else, even if it's too late to help the OP.

这篇关于html tidy删除空标签,例如&lt; i class ='icon-foo'&gt;&lt;/i&gt;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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