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

Many HTML tags reserved unnecessary spaces #383

Closed
doggy8088 opened this issue Mar 22, 2024 · 2 comments
Closed

Many HTML tags reserved unnecessary spaces #383

doggy8088 opened this issue Mar 22, 2024 · 2 comments
Labels
Milestone

Comments

@doggy8088
Copy link
Contributor

doggy8088 commented Mar 22, 2024

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 doggy8088 changed the title p tag reserved unnecessary spaces Many HTML tags reserved unnecessary spaces Mar 23, 2024
@mysticmind
Copy link
Owner

mysticmind commented Mar 23, 2024

I think, this has to be made configurable, will take a look. Earlier someone posted an issue that they want everything intact hence some changes were made to not trim things around.

@mysticmind
Copy link
Owner

Fixed via 8329d3e

@mysticmind mysticmind added this to the 4.6.0 milestone Jun 19, 2024
@mysticmind mysticmind added the bug label Jun 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants