Example #1
0
        public void Convert_GivenMarkdown_OutputsHtml()
        {
            var processor = new MarkdownProcessor("pandoc");

            var result = processor.Convert("# Hello World", Settings.Default);

            AssertHelper.AreEqualIgnoringNewLines("<h1 id=\"hello-world\">Hello World</h1>\r\n", result);
        }
Example #2
0
        public void Convert_BulletedList_OutputsCorrectHtml()
        {
            var markdown = new MarkdownProcessor();
            var result   = markdown.Convert("- I'm a list item.\n- I'm another one.", Settings.Default);

            AssertHelper.AreEqualIgnoringNewLines(
                "<ul>\r\n<li>I’m a list item.</li>\r\n<li>I’m another one.</li>\r\n</ul>\r\n",
                result);
        }
        public void GenerateFile_Markdown_OutputsHtml()
        {
            var output = generator.GenerateFile(".",
                                                new FileLocation("directory/index.md"),
                                                "Hello",
                                                Array.Empty <string>(),
                                                new Dictionary <string, IBuffer <ImmutableDictionary <string, object> > >().ToImmutableDictionary()
                                                );

            Assert.AreEqual(@"directory/index.html", output.Name.FullyQualifiedName);
            AssertHelper.AreEqualIgnoringNewLines("<p>Hello</p>\r\n", output.Output);
        }
Example #4
0
        public void Generator_ItemsHaveNoTemplate_ItemsNotRendered()
        {
            fs.InputFiles = new Dictionary <string, string>()
            {
                { "_template_.html", "t1 {{body}} t1" },
                { "index.md", "I'm the *root* index file" },
                { "blog/_template_.html", "{% capture body %}t2 {{ body }} t2{% endcapture %}" },
                { "blog/index.md", "{% capture body %}my posts:\r\n{% for item in post %}\r\n- {{ item.title }}{% endfor %}\r\n{% endcapture %}" },
                { "blog/_post_first.md", "{% assign title = 'Title 1' %}{% capture body %}\r\n content one \r\n{% endcapture %}" },
                { "blog/_post_second.md", "{% assign title = 'Title 2' %}{% capture body %} content two {% endcapture %}" },
            };

            generator.Generate(FakeFileSystem.Root, "_output", fs.InputFiles.Select(kvp => kvp.Key).ToList());

            AssertHelper.AreEqualIgnoringNewLines("<p>I’m the <em>root</em> index file</p>\r\n", fs.OutputFiles["_output/index.html"]);
            AssertHelper.AreEqualIgnoringNewLines("t1 t2<p>my posts:</p>\r\n<ul>\r\n<li>Title 1</li>\r\n<li>Title 2</li>\r\n</ul><p>t2 t1</p>", fs.OutputFiles["_output/blog/index.html"]);
            Assert.AreEqual(2, fs.OutputFiles.Count);
        }