try {
PegDownProcessor markdownProcessor = new PegDownProcessor(markdownOptions.getExtensionsValue());
final boolean resolveImageUrls = renderOptions.contains(RenderOption.RESOLVE_IMAGE_URLS);
final boolean resolveLinkUrls = renderOptions.contains(RenderOption.RESOLVE_LINK_URLS);
if (resolveImageUrls || resolveLinkUrls) {
RootNode rootNode = markdownProcessor.parseMarkdown(sourceText.toCharArray());
FileObject sourceFile = context.getPrimaryFile();
final PreviewSerializer htmlSerializer
= new PreviewSerializer(sourceFile.toURL(), resolveImageUrls, resolveLinkUrls);
bodyText = htmlSerializer.toHtml(rootNode);
}