コード例 #1
0
        public void Extension_AddsClassToFigureCaption_WhenUsed()
        {
            // arrange
            String mdString = "^^^ This is a caption";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }, "C:/Users/");
            MarkdownPipeline     markdownPipeline     = BuidPipeline(htmlParsingExtension);

            // Act
            String html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            Assert.AreEqual(html, "<figure class=\"figure\">\n<figcaption class=\"figure-caption\">This is a caption</figcaption>\n</figure>\n");
        }
コード例 #2
0
        public void Extension_UpdatesFigureClassAndRelativeUrltoAbsolute_WhenUsed()
        {
            // arrange
            String mdString = "![text](a.jpg \"Figure\")";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }, "C:\\Users\\");
            MarkdownPipeline     markdownPipeline     = BuidPipeline(htmlParsingExtension);

            // Act
            String html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            Assert.AreEqual(html, "<p><img src=\"file:///C:/Users/a.jpg\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n");
        }
コード例 #3
0
        public void Extension_CreatesCorrectAbsoluteLinkByTrimmingBackwardSlash_WhenUsed()
        {
            // arrange
            String mdString = "![text](/document/a.jpg \"Figure\")";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }, "C:/Users/");
            MarkdownPipeline     markdownPipeline     = BuidPipeline(htmlParsingExtension);

            // Act
            String html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            Assert.AreEqual(html, "<p><img src=\"file:///C:/Users/document/a.jpg\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n");
        }
コード例 #4
0
        public void Extension_UpdatesBlockQuotesClass_WhenUsed()
        {
            // Arrange
            String mdString = "> Blockquotes.";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { });
            MarkdownPipeline     markdownPipeline     = BuidPipeline(htmlParsingExtension);

            // Act
            String html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            Assert.AreEqual(html, "<blockquote class=\"blockquote\">\n<p>Blockquotes.</p>\n</blockquote>\n");
        }
コード例 #5
0
        public void Extension_UpdatesTablesClass_WhenUsed()
        {
            // Arrange
            String mdString = "| A | B |\n| -- | -- | ";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { });
            MarkdownPipeline     markdownPipeline     = BuidPipeline(htmlParsingExtension);

            // Act
            String html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            Assert.AreEqual(html, "<table class=\"table table-striped table-bordered\">\n<thead>\n<tr>\n<th>A</th>\n<th>B</th>\n</tr>\n</thead>\n</table>\n");
        }
コード例 #6
0
        public void Extension_RemovesExternalImageUrlAndMakeCallback_WhenUsed()
        {
            // arrange
            int    count    = 0;
            String mdString = "![text](http://dev.nodeca.com \"Figure\")";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { count++; });
            MarkdownPipeline     markdownPipeline     = BuidPipeline(htmlParsingExtension);

            // Act
            String html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            Assert.AreEqual(count, 1);
            Assert.AreEqual(html, "<p><img src=\"#\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n");
        }
コード例 #7
0
        public void ExtensionUpdatesFigureClassAndBlocksRelativeUrlWhenUsed()
        {
            // arrange
            string mdString = "![text](a.jpg \"Figure\")";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { }, "C:\\Users\\");
            MarkdownPipeline     markdownPipeline     = BuildPipeline(htmlParsingExtension);

            // Act
            string html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            const string expected = "<p><img src=\"#\" class=\"img-fluid\" alt=\"text\" title=\"Figure\" /></p>\n";

            Assert.AreEqual(expected, html);
        }
コード例 #8
0
        public void ExtensionUpdatesBlockQuotesClassWhenUsed()
        {
            // Arrange
            string mdString = "> Blockquotes.";
            HTMLParsingExtension htmlParsingExtension = new HTMLParsingExtension(() => { });
            MarkdownPipeline     markdownPipeline     = BuildPipeline(htmlParsingExtension);

            // Act
            string html = Markdown.ToHtml(mdString, markdownPipeline);

            // Assert
            const string expected = "<blockquote class=\"blockquote\">\n<p>Blockquotes.</p>\n</blockquote>\n";

            Assert.AreEqual(expected, html);
        }