jhy/jsoup — Issue #148: Add option to clean() that allows pretty printing to be disabled
Author: helsom
Created: 2011-12-01 13:24:34+00:00
State: open

It would be useful to have a way of disabling pretty printing of the returned html when using the jsoup.clean() method, to avoid injecting new line-feeds, etc.

Example test case:

@Test public void disablePrettyPrinting() {
String html = "

Paragraph one

Paragraph Two

Paragraph Three

";
Whitelist whitelist = Whitelist.none();
whitelist
.addTags("p");
String html = Jsoup.clean(html, whitelist, false); // new param to disable pretty printing?
assertEquals("

Paragraph one

Paragraph Two

Paragraph Three

", html);
}