782
Seen it coming
(lemmy.world)
Post funny things about programming here! (Or just rant about your favourite programming language.)
I don’t have Sync but I fired up Mlem and Avelon and they both also botched the spoiler tag. It doesn’t appear like it should be too hard to implement, wonder what’s going on?
Mlem dev here! Lemmy has a custom "flavor" of Markdown that is distinct from other social media platforms. Open-source markdown parsers and renderers exist for popular flavors of Markdown (e.g GitHub-flavor), but not for Lemmy-flavor. Most Lemmy clients choose to use an existing GitHub-flavor parser that is close enough to Lemmy's to be indistinguishable in most cases. Mlem uses swift-markdown-ui to render markdown, which uses cmark-gfm as its parser.
Lemmy's spoiler format is unique to Lemmy-flavor markdown, so that's one of the places where use of a third-party markdown parser is noticed by users. Other common parsing errors are ~subscript~ and footnotes.
Adding spoiler support is not particularly easy, unfortunately. You can't really apply spoiler-parsing logic on-top of another markdown parser - it has to be integrated into the parser itself. This is because the app needs to ignore spoiler markdown in certain situations, such as inside of a code block. The only good option is to write a custom markdown parser from scratch, or modify an existing markdown parser to support Lemmy's markdown dialect. Both options can be difficult for developers for several reasons:
This takes a significant amount of time for comparatively little value for users, so most client developers didn't prioritise it.
In an upcoming Mlem version, we're replacing our markdown parser renderer with a custom one that can render spoilers and subscripts, but we've got a way to go before we achieve full parity with Lemmy. If any developers of other apps are using cmark-gfm, you're welcome to use our code from that repo under the terms of the licence.
Sorry this is kinda long, I hope this answers your question
Great info, thanks!
This right here is why I love you guys. Someone posted a bug, and we already have two people testing said bug, and giving reports within 30 minutes of the bug report.
Never change Lemmy :)
Boost also has yet to implement spoiler tags.