示例#1
0
文件: Markdown.cs 项目: PhonkX/uLearn
        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));
        }