-
Notifications
You must be signed in to change notification settings - Fork 320
Closed
Description
I'm using the Parser/HtmlRenderer combo with escapeHtml(true), but this leaves html blocks without being wrapped in a paragraph tag. Please see the following example. It seems like incorrect behaviour to me.
Parsing code
public String render(String text) {
Parser parser = Parser.builder().build();
HtmlRenderer renderer = HtmlRenderer.builder().escapeHtml(true).build();
Node document = parser.parse(text);
return renderer.render(document);
}Input
This is a paragraph.
This is a paragraph.
<div>html here</div>
This is a paragraph.
This is a paragraph.
<strong>html here</strong>
This is a paragraph.
This is a paragraph.
<p>html here</p>
This is a paragraph.Expected output
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p><div>html here</div></p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p><strong>html here</strong></p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p><p>html here</p></p>
<p>This is a paragraph.</p>Actual output
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<div>html here</div>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p><strong>html here</strong></p>
<p>This is a paragraph.</p>
<p>This is a paragraph.</p>
<p>html here</p>
<p>This is a paragraph.</p>Note that the line <strong>html here</strong> actually is wrapped, but the other two aren't.
Metadata
Metadata
Assignees
Labels
No labels