Added Support for Line Breaks in Inline Elements #168
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Most markdown parsers support a line break feature as follows:
As long as there are two spaces following the end of the first line, these two lines will render separately as follows:
This line is separate from the following line
This line is on its own line
The way this works is that markdown parsers will see the two spaces and interpret it as a line break. Therefore, the two spaces will be replaced with a line break tag (i.e.,
<br>
).To replicate this behavior in SnakeMD, I have added a line break feature to the Inline element. When the line break flag is True, a line break will be added at the end of the Inline element.
However, because the Paragraph element in SnakeMD removes all whitespace, we can't replicate the line break behavior exactly. As a result, rather than changing the behavior of the Paragraph element (given its potential widespread use), an HTML line break will be produced instead of two spaces.
I believe this falls in line with the expectations of this library anyway. After all, if the user wants to use markdown, there Raw element should allow them to do so.