public static HtmlString RenderTex(this string textWithTex) { var texReplacer = new TexReplacer(textWithTex); string html = HttpUtility.HtmlEncode(texReplacer.ReplacedText); return(new HtmlString(texReplacer.PlaceTexInsertsBack(html))); }
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)); }