views:

122

answers:

2

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.

+1  A: 

hmm I don't see it in windows.

I am using Tidy with ruby

   @tidy.options.output_xhtml = true
   @tidy.options.show_body_only = true
   @tidy.clean('<p>Some text</p>')

I also ran the tidy script in unbuntu (tidy -m test.htm) but did not see that problem. You can control the spacing using the options at http://tidy.sourceforge.net/docs/quickref.html#PrettyPrintHeader

surajz
I've looked at those options before and none of those seem to do the needful. Btw, I am running TIDY through Notepad++, if that makes any difference.
markvgti
don't know how to do it with NotePad++ but 'wrap=160' option might help. But the issue that you are seeing might be related to notePad++
surajz
A: 

In php you can use:

$buffer = preg_replace('/\n<\//smUi','</',$buffer);
vlado