Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set default value " />" for MarkdownOptions.EmptyElementSuffix. #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MarkdownSharp/Markdown.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class MarkdownOptions
/// <summary>
/// use ">" for HTML output, or " />" for XHTML output
/// </summary>
public string EmptyElementSuffix { get; set; }
public string EmptyElementSuffix { get; set; } = " />";

/// <summary>
/// when false, email addresses will never be auto-linked
Expand Down
13 changes: 13 additions & 0 deletions tests/MarkdownSharp.Tests/ConfigTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,19 @@ public void TestAutoNewLines()
Assert.Equal("<p>Line1<br />\nLine2</p>\n", markdown.Transform("Line1\nLine2"));
}

[Fact]
public void TestDefaultOptions()
{
var markdownWithoutOptions = new Markdown();
Assert.Equal(" />", markdownWithoutOptions.EmptyElementSuffix);

var markdownWithOptions = new Markdown(new MarkdownOptions { });
Assert.Equal(" />", markdownWithOptions.EmptyElementSuffix);

var options = new MarkdownOptions { };
Assert.Equal(" />", options.EmptyElementSuffix);
}

[Fact]
public void TestEmptyElementSuffix()
{
Expand Down