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

Avoid backslashes before a new block. #373

Merged
merged 1 commit into from
Apr 9, 2024
Merged

Conversation

jneem
Copy link
Contributor

@jneem jneem commented Apr 6, 2024

This changes the behaviour of the commonmark renderer to avoid rendering newlines as backslashes (1) at the end of a block and (2) when the next node in the current block is a block.

Fixes #372.

This isn't quite the solution that I described in the comment, because I discovered another situation where backslash-newlines are treated differently from the double-space variant:

a
\
b

is parsed as a single paragraph with a line break, but the double-space version is parsed as two paragraphs with no line break. I think the backslash variant is the one most likely to round-trip correctly, so I went with that as often as possible.

@kivikakk
Copy link
Owner

kivikakk commented Apr 7, 2024

This looks awesome; thank you so much! 🤍

If either of @digitalmoksha or @gjtorikian are able to give it a once over, I would much appreciate it! But it looks like a very nice and straightforward improvement.

@gjtorikian gjtorikian merged commit 2c2de3f into kivikakk:main Apr 9, 2024
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Rendering of hard line breaks
3 participants