Sometimes in the wild there is HTML code with PRE sections containing BR tags instead of linefeeds, like so:
first line
second line
third line
JTidy's pretty-printer renders it like this ("break-before-br" is false):
first line
second line
third line
The result is that a browser renders two linefeeds where just one should exist, causing ugly empty lines in the output. The problem gets worse if for some reason I use multiple passes of JTidy, adding more and more linefeeds.
How to fix: never ever add newlines after BR tags inside PRE sections.
Proposed fix
I just uploaded my humble try to fix the problem. Maybe it is a bit hacky and not the optimal solution, sorry this was my first look into your code and I have not been programming for a while. But at least locally it solves my problem and might be potentially beneficiary for other users, too.
Test case
The uploaded test case is part of a download from Galileo press (Galileo Openbook about iPhone development). It is freely available for download, so no worries there. I ran JTidy to clean up the HTML code and bumped into the problem with unwanted blank lines in the PRE sections. Just search the HTML file for