hey-red / Markdown

Open source C# implementation of Markdown processor, as featured on Stack Overflow.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AutoNewlines set through MarkdownOptions replaces EOL with <br instead of <br />

GoogleCodeExporter opened this issue · comments

What steps will reproduce the problem?

If you set up markdown and then pass an option, things work swimmingly. But if 
you pass in markdownoptions, not so much. I've inspected the code and nothing 
jumps out at me on what might be wrong.

     [Test]
        public void TestAutoNewlinesVersusMarkdownOptions()
        {
            var markdown = new Markdown();
            markdown.AutoNewLines = true;
            var markdownWithOptions = new Markdown(new MarkdownOptions
                {
                    AutoNewlines = true,
                });

            Assert.AreEqual("<p>Markdown with options set separately<br />\nworks without issue<br />\nso this is good.</p>\n",
               markdown.Transform(@"Markdown with options set separately
works without issue
so this is good."));
            Assert.AreEqual("<p>Markdown set with MarkdownOptions<br />\nhas issues<br />\nbut it should not.</p>\n",
                markdownWithOptions.Transform(@"Markdown set with MarkdownOptions
has issues
but it should not."));


What is the expected output? What do you see instead?
Instead of "<br />", it replaces with "<br "


What version of the product are you using? On what operating system?

Anything SINCE the last release on nuget.


Original issue reported on code.google.com by trueblu...@gmail.com on 1 Jan 2015 at 2:03

commented

Set EmptyElementSuffix = " />" manually if you use MarkdownOptions or Config file(AppSettings)

new MarkdownOptions 
{
     EmptyElementSuffix = " />"
});

Updated: Now set the value is not need 8a7fb21