public void Should_handle_LT_sign()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "4 < 5";
         runner.Expected = "4 < 5";
     }
 }
 public void Should_handle_AND_sign_in_text()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "AT&amp;T";
         runner.Expected = "AT&T";
     }
 }
 public void Should_not_convert_empty_b()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input    = "<b>        </b>";
         runner.Expected = string.Empty;
     }
 }
 public void Should_handle_AND_sign()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "&copy;";
         runner.Expected = "&copy;";
     }
 }
 public void should_trim_anchor_title_and_text()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input    = "<a href=\"http://www.example.com\" title=\"   Example   \">   Visit Example    </a>";
         runner.Expected = "[Visit Example][0]\n\n[0]: http://www.example.com";
     }
 }
 public void Should_handle_AND_sign_in_text()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input    = "AT&amp;T";
         runner.Expected = "AT&T";
     }
 }
 public void Should_handle_LT_sign()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input    = "4 &lt; 5";
         runner.Expected = "4 < 5";
     }
 }
 public void Should_output_only_text_of_empty_links_inline()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input    = "<a href=\"\">Empty Link Text</a>";
         runner.Expected = "Empty Link Text";
     }
 }
 public void should_convert_image_wrapped_in_anchor_to_markdown_that_can_be_rendered_using_showdown_inline()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input    = "<a href=\"/exec/j/4/?pid=62838&lno=1&afsrc=1\"><img alt=\"Example Image\" title=\"Free example image\" src=\"/img/62838.jpg\"></a>";
         runner.Expected = "[![Example Image](/img/62838.jpg \"Free example image\")](/exec/j/4/?pid=62838&lno=1&afsrc=1)";
     }
 }
 public void Should_handle_AND_sign()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input    = "&copy;";
         runner.Expected = "&copy;";
     }
 }
 public void should_trim_anchor_title_and_text_relative_path()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "<a href=\"/blog/line-length-readability#comments\">\n" +
                        "<span itemprop=\"interactionCount\">32</span>\n" + "comments\n</a>";
         runner.Expected = "[32 comments][0]\n\n[0]: /blog/line-length-readability#comments";
     }
 }
        public void Should_be_able_to_convert_a_block_of_html()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<p>This is a paragraph. Followed by a blockquote.</p><blockquote><p>This is a blockquote which will be truncated at 75 characters width. It will be somewhere around here.</p></blockquote>" + "<p>Some list for you:</p><ul><li>item a</li><li>item b</li></ul><p>So which one do you choose?</p>";

                runner.Expected = "This is a paragraph. Followed by a blockquote.\n\n> \nThis is a blockquote which will be truncated at 75 characters width. It \nwill be somewhere around here.\n\nSome list for you:\n\n* item a\n* item b\n\nSo which one do you choose?\n\n";
            }
        }
        public void Should_be_able_to_convert_tables_with_lists()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input  = "<table border=\"1\">";
                runner.Input += "<tr><td width=\"50%\"><ul><li>List Item 1</li><li>List Item 2</li></ul></td>";
                runner.Input += "<td><ul><li>List Item 3</li><li>List Item 4</li></ul></td></tr>";
                runner.Input += "</table>";

                runner.Expected = "* List Item 1\n* List Item 2\n\n* List Item 3\n* List Item 4\n\n";
            }
        }
        public void should_be_able_to_convert_tables_to_row_syntax()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input  = "<table border=\"1\">";
                runner.Input += "<tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>";
                runner.Input += "<tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>";
                runner.Input += "</table>";

                runner.Expected  = "Row 1 Cell 1\n\n";
                runner.Expected += "Row 1 Cell 2\n\n";
                runner.Expected += "Row 2 Cell 1\n\n";
                runner.Expected += "Row 2 Cell 2\n\n";
            }
        }
        public void should_be_able_to_convert_list_items_with_linked_image_as_only_linked_image()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input  = "before list";
                runner.Input += "<ul>\n";
                runner.Input += "	<li><div class=\"curve-down\"><a href=\"/ipad/#video\"><img src=\"http://image.apple.com/home/image/promo_video_ipad_launch.png\" alt=\"Watch the new iPad video\" width=\"237\" height=\"155\" /><span class=\"play\"></span></a></div></li>";
                runner.Input += "	<li><div class=\"curve-down\"><a href=\"/iphone/videos/#tv-ads-datenight\"><img src=\"http://image.apple.com/home/image/promo_video_iphone4s_ad.png\" alt=\"Watch the new iPhone TV Ad\" width=\"237\" height=\"155\" /><span class=\"play\"></span></a></div></li>";
                runner.Input += "</ul>\n";

                runner.Expected  = "before list\n\n";
                runner.Expected += "[![Watch the new iPad video](http://image.apple.com/home/image/promo_video_ipad_launch.png)](/ipad/#video)\n\n";
                runner.Expected += "[![Watch the new iPhone TV Ad](http://image.apple.com/home/image/promo_video_iphone4s_ad.png)](/iphone/videos/#tv-ads-datenight)\n\n";
            }
        }
        public void should_be_able_to_convert_pre_block()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input  = "<pre>";
                runner.Input += "	void main(String[] args) {\n";
                runner.Input += "		System.out.println(\"Hello Markdown\");\n";
                runner.Input += "	}";
                runner.Input += "</pre>";

                runner.Expected  = "    " + "	void main(String[] args) {\n";
                runner.Expected += "    " + "		System.out.println(\"Hello Markdown\");\n";
                runner.Expected += "    " + "	}";
                runner.Expected += "\n\n";
            }
        }
        public void should_be_able_to_convert_code_inside_pre_blocks()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<pre><code>{% blockquote [author[, source]] [link] [source_link_title] %}" +
                               "\nQuote string"
                               + "\n{% endblockquote %}"
                               + "\n</code></pre>";

                runner.Expected = "    {% blockquote [author[, source]] [link] [source_link_title] %}"
                                  + "\n    Quote string"
                                  + "\n    {% endblockquote %}"
                                  + "\n    "
                                  + "\n\n";
            }
        }
        public void should_be_able_to_convert_pre_block_with_html_tags()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input  = "<pre>\n";
                runner.Input += "<div a=\"b\">\n";
                runner.Input += "	<span>this is span inside pre block</span>\n";
                runner.Input += "	this is paragraph inside pre block\n";
                runner.Input += "</div>";
                runner.Input += "</pre>";

                runner.Expected  = "    " + "\n\n\n";
                runner.Expected += "    " + "	this is span inside pre block\n";
                runner.Expected += "    " + "	this is paragraph inside pre block\n";
                runner.Expected += "    " + "\n";
                runner.Expected += "\n";
            }
        }
        public void should_be_able_to_convert_code_inside_pre_blocks()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<pre><code>{% blockquote [author[, source]] [link] [source_link_title] %}" +
                               "\nQuote string"
                               + "\n{% endblockquote %}"
                               + "\n</code></pre>";

                runner.Expected = "    {% blockquote [author[, source]] [link] [source_link_title] %}"
                                  + "\n    Quote string"
                                  + "\n    {% endblockquote %}"
                                  + "\n    "
                                  + "\n\n";
            }
        }
        public void should_be_able_to_convert_pre_block_with_html_tags()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<pre>\n";
                runner.Input += "<div a=\"b\">\n";
                runner.Input += "	<span>this is span inside pre block</span>\n";
                runner.Input += "	this is paragraph inside pre block\n";
                runner.Input += "</div>";
                runner.Input += "</pre>";

                runner.Expected = "    " + "\n\n\n";
                runner.Expected += "    " + "	this is span inside pre block\n";
                runner.Expected += "    " + "	this is paragraph inside pre block\n";
                runner.Expected += "    " + "\n";
                runner.Expected += "\n";
            }
        }
        public void should_convert_image_wrapped_in_anchor_to_markdown_that_can_be_rendered_using_showdown()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<a href=\"/exec/j/4/?pid=62838&lno=1&afsrc=1\"><img alt=\"Example Image\" title=\"Free example image\" src=\"/img/62838.jpg\"></a>";
                runner.Expected = "[![Example Image](/img/62838.jpg \"Free example image\")](/exec/j/4/?pid=62838&lno=1&afsrc=1)";

                //var html = "<a href=\"/exec/j/4/?pid=62838&lno=1&afsrc=1\">\n\t<img alt=\"Example Image\" title=\"Free example image\" src=\"/img/62838.jpg\">\n\t</a>";
            }
        }
        public void should_be_able_to_convert_list_items_with_linked_image_as_only_linked_image()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "before list";
                runner.Input += "<ul>\n";
                runner.Input += "	<li><div class=\"curve-down\"><a href=\"/ipad/#video\"><img src=\"http://image.apple.com/home/image/promo_video_ipad_launch.png\" alt=\"Watch the new iPad video\" width=\"237\" height=\"155\" /><span class=\"play\"></span></a></div></li>";
                runner.Input += "	<li><div class=\"curve-down\"><a href=\"/iphone/videos/#tv-ads-datenight\"><img src=\"http://image.apple.com/home/image/promo_video_iphone4s_ad.png\" alt=\"Watch the new iPhone TV Ad\" width=\"237\" height=\"155\" /><span class=\"play\"></span></a></div></li>";
                runner.Input += "</ul>\n";

                runner.Expected = "before list\n\n";
                runner.Expected += "[![Watch the new iPad video](http://image.apple.com/home/image/promo_video_ipad_launch.png)](/ipad/#video)\n\n";
                runner.Expected += "[![Watch the new iPhone TV Ad](http://image.apple.com/home/image/promo_video_iphone4s_ad.png)](/iphone/videos/#tv-ads-datenight)\n\n";
            }
        }
 public void should_trim_anchor_title_and_text_relative_path()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "<a href=\"/blog/line-length-readability#comments\">\n" +
                        "<span itemprop=\"interactionCount\">32</span>\n" + "comments\n</a>";
         runner.Expected = "[32 comments][0]\n\n[0]: /blog/line-length-readability#comments";
     }
 }
 public void should_trim_anchor_title_and_text()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "<a href=\"http://www.example.com\" title=\"   Example   \">   Visit Example    </a>";
         runner.Expected = "[Visit Example][0]\n\n[0]: http://www.example.com";
     }
 }
 public void Should_not_convert_empty_b()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "<b>        </b>";
         runner.Expected = string.Empty;
     }
 }
        public void Should_be_able_to_convert_tables_with_lists()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<table border=\"1\">";
                runner.Input += "<tr><td width=\"50%\"><ul><li>List Item 1</li><li>List Item 2</li></ul></td>";
                runner.Input += "<td><ul><li>List Item 3</li><li>List Item 4</li></ul></td></tr>";
                runner.Input += "</table>";

                runner.Expected = "* List Item 1\n* List Item 2\n\n* List Item 3\n* List Item 4\n\n";
            }
        }
 public void Should_output_only_text_of_empty_links_inline()
 {
     using (var runner = new HtmlToMarkdownRunner())
     {
         runner.Input = "<a href=\"\">Empty Link Text</a>";
         runner.Expected = "Empty Link Text";
     }
 }
        public void should_be_able_to_convert_pre_block()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<pre>";
                runner.Input += "	void main(String[] args) {\n";
                runner.Input += "		System.out.println(\"Hello Markdown\");\n";
                runner.Input += "	}";
                runner.Input += "</pre>";

                runner.Expected = "    " + "	void main(String[] args) {\n";
                runner.Expected += "    " + "		System.out.println(\"Hello Markdown\");\n";
                runner.Expected += "    " + "	}";
                runner.Expected += "\n\n";
            }
        }
        public void should_be_able_to_convert_tables_to_row_syntax()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<table border=\"1\">";
                runner.Input += "<tr><td>Row 1 Cell 1</td><td>Row 1 Cell 2</td></tr>";
                runner.Input += "<tr><td>Row 2 Cell 1</td><td>Row 2 Cell 2</td></tr>";
                runner.Input += "</table>";

                runner.Expected = "Row 1 Cell 1\n\n";
                runner.Expected += "Row 1 Cell 2\n\n";
                runner.Expected += "Row 2 Cell 1\n\n";
                runner.Expected += "Row 2 Cell 2\n\n";
            }
        }
        public void Should_be_able_to_convert_a_block_of_html()
        {
            using (var runner = new HtmlToMarkdownRunner())
            {
                runner.Input = "<p>This is a paragraph. Followed by a blockquote.</p><blockquote><p>This is a blockquote which will be truncated at 75 characters width. It will be somewhere around here.</p></blockquote>" + "<p>Some list for you:</p><ul><li>item a</li><li>item b</li></ul><p>So which one do you choose?</p>";

                runner.Expected = "This is a paragraph. Followed by a blockquote.\n\n> \nThis is a blockquote which will be truncated at 75 characters width. It \nwill be somewhere around here.\n\nSome list for you:\n\n* item a\n* item b\n\nSo which one do you choose?\n\n";
            }
        }