Пример #1
0
        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);
        }
Пример #2
0
        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));
        }
Пример #3
0
 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());
 }
Пример #4
0
 public string Format(string content)
 {
     var renderer = new MarkdownNetByBrianJeremy(request.Url.GetLeftPart(UriPartial.Authority) + request.ApplicationPath);
     return renderer.Render(content);
 }