Add error handler to renderMarkdown()