Пример #1
0
        public static HtmlString RenderTex(this string textWithTex)
        {
            var    texReplacer = new TexReplacer(textWithTex);
            string html        = HttpUtility.HtmlEncode(texReplacer.ReplacedText);

            return(new HtmlString(texReplacer.PlaceTexInsertsBack(html)));
        }
Пример #2
0
        public static string RenderMarkdown(this string markdown, string baseUrlForRelativeLinks = null)
        {
            var texReplacer = new TexReplacer(markdown);

            var markdownObject = new ExtendedMarkdownDeep
            {
                NewWindowForExternalLinks = true,
                ExtraMode       = true,
                SafeMode        = false,
                MarkdownInHtml  = false,
                UrlBaseLocation = baseUrlForRelativeLinks,
            };

            markdownObject.FormatCodeBlock += FormatCodePrettyPrint;
            var html = markdownObject.Transform(texReplacer.ReplacedText);

            return(texReplacer.PlaceTexInsertsBack(html));
        }