String (@Nullable String s) { if (s == null) return null; @NonNls StringBuilder sb = new StringBuilder("<html><body><pre>"); try { @NonNls Matcher m = URLUtil.URL_PATTERN.matcher(StringUtil.escapeXmlEntities(s)); while (m.find()) { if (m.groupCount() > 0) { String url = m.group(0); m.appendReplacement(sb, HtmlChunk.link(url, url).toString()); } } m.appendTail(sb); } catch (Exception e) { LOG.warn(e); } sb.append("</pre></body></html>"); return sb.toString(); }