public final class TagRendering extends Object
Utilities for tag rendering.
| Modifier and Type | Method and Description |
|---|---|
static String |
simplifySingleParagraph(String html)
Removes the
<p> tag if the given HTML contains only one paragraph. |
public static String simplifySingleParagraph(String html)
Removes the <p> tag if the given HTML contains only one paragraph.
Note: This implementation may be a bit simplistic: If the HTML starts with a
<p> tag, it will be removed. If it ends with </p>, this one will be removed,
too. In 99% of the cases, this exactly what we wanted. It some special cases,
the result may be invalid HTML – it should never break things, however, because
HTML is designed to handle “forgotten” tags gracefully.
<p> or trailing </p>.