reversemarkdown-net icon indicating copy to clipboard operation
reversemarkdown-net copied to clipboard

Many HTML tags reserved unnecessary spaces

Open doggy8088 opened this issue 3 months ago • 1 comments

There are many HTML tags such as p, span, div, ...etc. reserved unnecessary spaces that will lead to generate wrong Markdown document.

Here is my code snippet:

void Main()
{
	var html = """
<h1>Announcing SQL Server Data Tools (SSDT) for ARM64 Architecture in Visual Studio 17.10 Preview 2</h1>
<p>
            March 20th, 2024</p>
""";

	var config = new ReverseMarkdown.Config
	{
		// Include the unknown tag completely in the result (default as well)
		UnknownTags = Config.UnknownTagsOption.Drop,
		// generate GitHub flavoured markdown, supported for BR, PRE and table tags
		GithubFlavored = true,
		// will ignore all comments
		RemoveComments = true,
		// remove markdown output for links where appropriate
		SmartHrefHandling = true,
		ListBulletChar = '-',
		SuppressDivNewlines = true,
	};

	(new ReverseMarkdown.Converter(config)).Convert(html).Dump();
}

The output:

# Announcing SQL Server Data Tools (SSDT) for ARM64 Architecture in Visual Studio 17.10 Preview 2
 
             March 20th, 2024

I think the "spaces" before March 20th, 2024 should be removed.

The LINQPad query: https://share.linqpad.net/626vojje.linq

doggy8088 avatar Mar 22 '24 16:03 doggy8088