use of org.pegdown.ParsingTimeoutException in project gitblit by gitblit.
the class MarkdownUtils method transformMarkdown.
/**
* Returns the html version of the markdown source text.
*
* @param markdown
* @return html version of markdown text
* @throws java.text.ParseException
*/
public static String transformMarkdown(String markdown, LinkRenderer linkRenderer) {
try {
PegDownProcessor pd = new PegDownProcessor(ALL & ~SMARTYPANTS & ~ANCHORLINKS);
RootNode astRoot = pd.parseMarkdown(markdown.toCharArray());
return new WorkaroundHtmlSerializer(linkRenderer == null ? new LinkRenderer() : linkRenderer).toHtml(astRoot);
} catch (ParsingTimeoutException e) {
return null;
}
}
Aggregations