public string RenderHtml(string markdown)
        {
            if (markdown == null)
            {
                throw new ArgumentNullException("markdown");
            }

            var writer   = new StringWriter();
            var renderer = new Markdig.Renderers.HtmlRenderer(writer);

            renderer.ObjectWriteBefore += Renderer_ObjectWriteBefore;
            pipelineUnsafe.Setup(renderer);

            var document = Markdig.Markdown.Parse(markdown, pipelineUnsafe);

            renderer.Render(document);
            writer.Flush();
            return(writer.ToString());
        }
        public string RenderHtmlSafe(string markdown, bool keepLineBreaks = false)
        {
            if (markdown == null)
            {
                throw new ArgumentNullException("markdown");
            }

            if (keepLineBreaks)
            {
                markdown = newlinePreserverRegex.Replace(markdown, NEWLINE_PRESERVER_PATTERN);
            }

            var writer   = new StringWriter();
            var renderer = new Markdig.Renderers.HtmlRenderer(writer);

            renderer.ObjectWriteBefore += Renderer_ObjectWriteBefore;
            pipelineSafe.Setup(renderer);

            var document = Markdig.Markdown.Parse(markdown, pipelineSafe);

            renderer.Render(document);
            writer.Flush();
            return(writer.ToString());
        }