45
1day
8

It looks like PieFed's markdown parser isn't conforming to the standard regarding line breaks

I'm using the markdown editor GUI on PieFed.

A comment I wrote looked OK on PieFed, despite me having doubts because I didn't add spaces at the end of lines to force line breaks.

Today I saw it in Mlem, and line breaks were as expected, not as I've seen them on the PieFed web UI. On Lemmy, they are the same as in Mlem.

PieFed: https://piefed.zip/comment/2945722

https://piefedimages.s3.eu-central-003.backblazeb2.com/posts/wb/je/wbje9TVF19BwQJ5.png

Lemmy: https://discuss.tchncs.de/post/51439392/22823110

https://piefedimages.s3.eu-central-003.backblazeb2.com/posts/ky/4v/ky4v1C4WMk1Pka8.png

Mlem shows it like Lemmy. No screenshot necessary.

Summary: In Markdown, you need to add 2 or more spaces at the end of a line to force a line break. I didn't do that. A client app and a Lemmy instance show the text correct without a line break. PieFed adds a line break.

Update: I'm terribly sorry for using the word “standard” in a non-standard way. I mean this: https://daringfireball.net/projects/markdown/syntax#p

Update 2: Created issue #1524.

wjs018 - 1day

I have written a big chunk of the markdown_to_html function at this point, I can try to take a look at this. A situation like this isn't anything we have added to the function, so it must be how the markdown2 python library we are using is interpreting things. Ideally, this is the behavior I would want for line breaks.

12
Stefan_S_from_H - 1day

I have created issue #1524.

4
Stefan_S_from_H - 1day

Yes, markdown_to_html() in app/utils.py sets the breaks of markdown2 to on_newline.

From the documentation (in the source file): on_newline: Replace single new line characters with <br> when True

(WOW! I missed escaping the <br> and it made a line break in the preview?)

2
wjs018 - 1day

Yep, I just made a PR. I am so used to the more normal way markdown works that I never actually ran into this issue before. I am not sure if this change might break something else in the codebase since markdown_to_html is used in lots of places, so I will let @rimu@piefed.social review it instead of just merging it myself.

3
Rimu - 1day

Merged, thanks @wjs018@piefed.social and @stefan_s_from_h@piefed.zip

3
Stefan_S_from_H - 1day

Yes, it gets used for emails, too. Server admins would need to change their email texts. That's bad. But at this time the number of instances with PieFed is still below 1,000.

2
Auster - 1day

Unsure if PieFed is the same, but double space in my instance adds a simple line break, while double enter adds a blank line between paragraphs. And in both cases, they need to be added manually. Maybe it's a similar situation on PieFed instances?

3