Extra Space Added in Empty Lines in Markdown Component

General TRichView support forum. Please post your questions here
Post Reply
a.mancini
Posts: 22
Joined: Tue Jan 16, 2024 3:35 pm

Extra Space Added in Empty Lines in Markdown Component

Post by a.mancini »

Hello,

We have encountered an issue with the Markdown component used in our project.
Whenever an empty line is present in the Markdown content, saving and reloading the document introduces an extra space in the empty line.

This behavior becomes problematic when editing a document multiple times, as it requires manually removing the unwanted spaces to maintain proper alignment between lines. If unnoticed, these additional spaces can lead to inconsistencies in the document layout and formatting.

Best regards
Alessandro Mancini
Sergey Tkachenko
Site Admin
Posts: 17679
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Re: Extra Space Added in Empty Lines in Markdown Component

Post by Sergey Tkachenko »

Unfortunately, Markdown does not allow empty paragraphs. So TRichView adds a non-breaking space ( ) to them when saving.
It would be possible to save <br> instead. <br> is one of few HTML tags that TRichView parses inside Markdown. However, this is not a paragraph break but a line break inside a paragraph.
I can add an option in loading to remove NBSP in paragraphs loaded from Markdown, if this is the only character in the paragraph.
a.mancini
Posts: 22
Joined: Tue Jan 16, 2024 3:35 pm

Re: Extra Space Added in Empty Lines in Markdown Component

Post by a.mancini »

Thank you for your explanation regarding the handling of empty paragraphs in Markdown. I understand the current behavior and appreciate the clarification.

I believe the proposed option to remove non-breaking spaces (NBSP) in paragraphs loaded from Markdown, if they are the only character in the paragraph, would be a great solution. I kindly ask you to implement this feature, as it would significantly improve the usability of the component in our use case.

I look forward to the next version including this option and want to thank you for considering this enhancement.
Post Reply