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

A line ending that is preceded by a backslash is not parsed as a hard line break #1464

Closed
AUVESY-Nachwuchskraefte opened this issue May 17, 2024 · 3 comments
Labels
wontfix The issue will not be fixed for the stated reasons.

Comments

@AUVESY-Nachwuchskraefte

good morning everyone!

when trying to render linebreaks within paragraphs with a backslash at the end of the line as in the spec the backslash will not be used as a formatting character but stay as is.

# linebreaks

asd
asd

das\
das

sad  # 2 spaces
sad

## python-markdown

<h1>linebreaks</h1>
<p>asd
asd</p>
<p>das\
das</p>
<p>sad<br />
sad</p>

## mistletoe

<h1>linebreaks</h1>
<p>asd
asd</p>
<p>das<br />
das</p>
<p>sad<br />
sad</p>
@facelessuser
Copy link
Collaborator

@AUVESY-Nachwuchskraefte Python Markdown is an old-school Markdown parser that predates CommonMark. It is not a CommonMark parser, so any expectations that it should adhere to the CommonMark spec need to be set aside.

With that said, you can get the behavior you are looking for with this extension: https://facelessuser.github.io/pymdown-extensions/extensions/escapeall/.

@waylan
Copy link
Member

waylan commented May 20, 2024

As our documentation notes:

This is not a CommonMark implementation; nor is it trying to be! Python-Markdown was developed long before the CommonMark specification was released and has always (mostly) followed the syntax rules and behavior of the original reference implementation. No accommodations have been made to address the changes which CommonMark has suggested. It is recommended that you look elsewhere if you want an implementation which follows the CommonMark specification.

Note that backslash escapes are only applied to a subset of characters as defined in the rules and a newline is not one of them (see BACKSLASH ESCAPES). Therefore, there should be no expectation that a backslash escape would have any effect on a newline character. Instead, the rules provide for a hard break by preceding a newline with two or more spaces (see PARAGRAPHS AND LINE BREAKS).

Given the above, this is being closed as wontfix.

@waylan waylan closed this as not planned Won't fix, can't repro, duplicate, stale May 20, 2024
@waylan waylan added the wontfix The issue will not be fixed for the stated reasons. label May 20, 2024
@AUVESY-Nachwuchskraefte
Copy link
Author

Thank you for your response, I overlooked the "note" in your documentation.

@facelessuser thanks for your provided solution, I will try it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix The issue will not be fixed for the stated reasons.
Projects
None yet
Development

No branches or pull requests

3 participants