String (@NotNull PsiElement context, @NotNull String codeFragment) { try { StringWriter writer = new StringWriter(); new HTMLTextPainter(context, codeFragment).paint(null, writer, false); return writer.toString(); //NON-NLS } catch (ProcessCanceledException cancel) { throw cancel; } catch (Throwable e) { LOG.error(e); return String.format("<pre>%s</pre>\n", codeFragment); //NON-NLS } }