public static Spannable getFormattedHtml(final String html, final boolean prettyPrint, final boolean colorize, final boolean isLightMode) {
        final Document document = Jsoup.parse(html);
        if (prettyPrint) {
            document.outputSettings().prettyPrint(true).indentAmount(2).outline(true);
        } else {
            document.outputSettings().prettyPrint(false).outline(false);
        }
        if (!colorize) {
            return new SpannableString(document.body().html());
        }
        final HtmlTokenAppender ca = new HtmlTokenAppender();
        document.body().html(ca);
        final SpannableStringBuilder ssb = new SpannableStringBuilder();
        ssb.append(ca.textBuilder.toString());
        for (TokenData sd : ca.foundTokens) {
            sd.applyTo(ssb, isLightMode);
        }
        TextUtils.setSpan(ssb, new TypefaceSpan("monospace"));
        return ssb;
    }
returns formatted HTML data (syntax-corrected as well as pretty-printed and colorized according to input parameters)
main/src/main/java/cgeo/geocaching/utils/html/HtmlUtils.java