Spyke

Syndicated from the fediverse. Read and engage on the original instance.

View original on piefed.social

Another one about Lemmy and Piefed seeing/parsing things differently.

Apparently Lemmy turns my backslashes (used to escape round brackets inside a link) into forward slashes, leading to Lemmy users complaining:

Lemmy does not require the round bracket to be escaped in this case. Why it turns backslashes into forward slashes I have no idea, but it does so even when I try the same thing straight from a Lemmy instance.

Is escaping things with backslashes not common practice in Markdown?

I know there's so many implementations of Markdown it's hard to even speak of a Spec, but backslashes serve this purpose almost universally. On computers that is.

I sense an overarching narrative of Lemmy vs Piefed developing here. Or maybe a need for communication between all client developers, on how to implement things so they work across the fediverse.

Hmm, it does feel more like a Lemmy problem in this case.
Where could I raise awareness on the Lemmy side, short of opening an issue on their git repos?

View original on piefed.social
7

6 replies

Piefed uses the markdown2 python library for the markdown to html conversion, and I think it must differ from how lemmy handles things in this case.

Like you point out though, markdown is hardly standardized at all when it comes to edge cases like this. I have written tons of code to handle special cases to make piefed's markdown parse the same as lemmy, and to handle special cases like lemmy spoiler blocks. This is a case that I wasn't aware of until this post.

I'll do some experiments and see if I can help handle this too. I won't be able to sit down and take a look until next week though.

2
palaver.p3x.de

I've had issues with those and Markdown as well. One way to get around it, is to encode the brackets the same way the 'ö' is encoded and replace the opening bracket with %28 and the closing one with %29 That's the only universal solution I'm aware of.

That'd be this link

Just for testing I'll add a link just as is with the brackets unescaped and another one with backslashes

Seems they all work on PieFed and the first two work on Lemmy as well, just not the backslash one.

[this link](https://de.wikipedia.org/wiki/Zollstock_%28K%C3%B6ln%29)  
[link just as is](https://de.wikipedia.org/wiki/Zollstock_(K%C3%B6ln))  
[another one with backslashes](https://de.wikipedia.org/wiki/Zollstock_/(K%C3%B6ln/))  

Last one also gets changed around when quoted on Lemmy. Those are backslashes, not forward slashes. See: https://lemmy.world/post/52671143

2
piefed.social

TESTING

Zollstock

It works without escaping! Why did I even get into the habit? Must've been a problem months if not years ago. FWIW, escaping with backslashes characters that might otherwise have MD-specific meaning is common, normal even.

Ignore it if you will, but converting them to forward slashes is just wrong.

2

Yes. Pretty sure this isn't the first complaint about the Markdown parsing. We've had some changes in the past. And I'm not even sure if this is well-defined. Some of Markdown is a bit weird. If I remember correctly, I've used software before which just uses the first closing bracket and cuts off the link there. And another question: What happens if a URL contains a mismatched amount of brackets? like https://palaver.p3x.de/test)page I don't think that'd workpage)

Edit: Yeah, that's just wrong 😅

2

I assume \ gets changed to / because they are supposed to be equivalent as directory separators? You know, Windows stuff. Either way, in a URI, you should use URI encoding to escape characters, not markdown escapes. So that'd be %28, not \(.

0

You reached the end

Another one about Lemmy and Piefed seeing/parsing things differently. | Spyke