No linebreak after tags in tidy

强颜欢笑 提交于 2019-12-07 09:03:30

问题


HI, I have the following input:

<p>Hi <span>you</span></p>

I'd like to treat this as XML.

I run Tidy on the cmd-line with the following options:

input-xml: yes 
output-xml: yes 
indent: no

My output is this:

<p>Hi 
<span>you</span></p>

However I'd like tidy to not pretty-print the xml. I'd like it to respect all white space, and not add that line break. I can't seem to find a way to output XML without pretty-printing. Anyone know how to do this?


回答1:


I had the same problem. I found a possible solution and posted it at PHP Tidy removes whitespace and inserts newlines

The summary is: put <pre>-tags around the xml you want to repair, use output-html = true, then remove the <pre>-tags and newlines.



来源:https://stackoverflow.com/questions/4048234/no-linebreak-after-tags-in-tidy

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!