mysticmind / reversemarkdown-net

ReverseMarkdown.Net is a Html to Markdown converter library in C#. Conversion is very reliable since HtmlAgilityPack (HAP) library is used for traversing the Html DOM
MIT License
283 stars 67 forks source link

Question about blank line handling #394

Open tspence opened 3 months ago

tspence commented 3 months ago

Question about blank line handling in ReverseMarkdown:

I have a process that converts from Markdown to HTML and back again, depending on various conditions. One user would like to create a fixed number of blank lines in their content, and it seems like the pipeline ends up trimming these blank lines.

Example: The following HTML converts into the following markdown:

<p>This is my first line!</p>
<p></p>
<p></p>
<p>This is the fourth line.</p>

Converts into this markdown: This is my first line!\r\n\r\nThis is the fourth line.

Of course, when you convert this back into HTML later, there's only one blank line. It seems like the markdown should have four \r\n pairs in it, right?

mysticmind commented 3 months ago

In the recent changes, I have a config CleanupUnnecessarySpaces, please try this and see by setting it to false. I have to add in the read me docs.

That said, having so many blank lines in markdown is not right since any markdown to html converter is going to ignore the extraneous blank lines and will keep it to one.

On Thu, 1 Aug 2024 at 4:53 AM, Ted Spence @.***> wrote:

Question about blank line handling in ReverseMarkdown:

I have a process that converts from Markdown to HTML and back again, depending on various conditions. One user would like to create a fixed number of blank lines in their content, and it seems like the pipeline ends up trimming these blank lines.

Example: The following HTML converts into the following markdown:

This is my first line!

This is the fourth line.

Converts into this markdown: This is my first line!\r\n\r\nThis is the fourth line.

Of course, when you convert this back into HTML later, there's only one blank line. It seems like the markdown should have four \r\n pairs in it, right?

— Reply to this email directly, view it on GitHub https://github.com/mysticmind/reversemarkdown-net/issues/394, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAV3IUCAPPY4I7GB3O5II5TZPFWYJAVCNFSM6AAAAABLZNHETCVHI2DSMVQWIX3LMV43ASLTON2WKOZSGQ2DCMJSGIYDCNA . You are receiving this because you are subscribed to this thread.Message ID: @.***>