Beispiel #1
0
        public void ImagesWithBaseUrl()
        {
            var altText   = "This is alt text";
            var imgSrc    = "image.png";
            var imageBase = "/base";
            var markdown  = $"![{altText}]({imgSrc})";

            var webSiteOptions = new WebSiteOptions
            {
                ImageBasePath = imageBase
            };
            var renderer = new WebsiteMarkupRenderer(webSiteOptions, null);

            AssertEquivalentHtml($"<p><img src=\"{imageBase}/{imgSrc}\" class=\"img-fluid\" alt=\"{altText}\"/>", renderer.RenderHtml(markdown));
        }
Beispiel #2
0
        public void ExternalLinkWithBaseUrl()
        {
            var linkhref = "http://127.0.0.1/abc/page1.htm";
            var baseUrl  = "http://localhost";
            var text     = "Some link";
            var markdown = $"[{text}]({linkhref})";

            var webSiteOptions = new WebSiteOptions
            {
                ImageBasePath = "somethingElse",
                SiteUrl       = baseUrl
            };
            var renderer = new WebsiteMarkupRenderer(webSiteOptions, null);

            AssertEquivalentHtml($"<p><a href=\"{linkhref}\" rel=\"nofollow\">{text}</a></p>", renderer.RenderHtml(markdown));
        }