public string Format(string content) { var relativePathUrlPrefix = request.GetOriginalUrl().GetLeftPart(UriPartial.Authority) + request.ApplicationPath; var relativePathUrlPrefixLength = relativePathUrlPrefix.Length; // This fixes the issue where links such as <a href="/some/thing"></a> are rendered as http://domain//some/thing // Notice the double slash after the domain (or application name) relativePathUrlPrefix = relativePathUrlPrefix[relativePathUrlPrefixLength - 1] == '/' ? relativePathUrlPrefix.Substring(0, relativePathUrlPrefixLength - 1) : relativePathUrlPrefix; var renderer = new MarkdownNetByBrianJeremy(relativePathUrlPrefix); return renderer.Render(content); }
public string Format(string content) { var relativePathUrlPrefix = request.GetOriginalUrl().GetLeftPart(UriPartial.Authority) + request.ApplicationPath; var relativePathUrlPrefixLength = relativePathUrlPrefix.Length; // This fixes the issue where links such as <a href="/some/thing"></a> are rendered as http://domain//some/thing // Notice the double slash after the domain (or application name) relativePathUrlPrefix = relativePathUrlPrefix[relativePathUrlPrefixLength - 1] == '/' ? relativePathUrlPrefix.Substring(0, relativePathUrlPrefixLength - 1) : relativePathUrlPrefix; var renderer = new MarkdownNetByBrianJeremy(relativePathUrlPrefix); return(renderer.Render(content)); }
protected void Expect(string markdown, string html) { var renderer = new MarkdownNetByBrianJeremy("http://www.foo.com"); var result = renderer.Render(markdown); Assert.AreEqual(html.Trim(), result.Trim()); }
public string Format(string content) { var renderer = new MarkdownNetByBrianJeremy(request.Url.GetLeftPart(UriPartial.Authority) + request.ApplicationPath); return renderer.Render(content); }