I'm thinking of submitting a PR for a 'lemmy-spoiler' tag to Markdown2

Lemmy's spoiler format is
::: spoiler VISIBLE
HIDDEN 1
HIDDEN 2
:::

As described here

The regex I've come up with is :{3} spoilers+?(S.+?n)(.+?)n:{3}

It won't do spoilers inside spoilers, but that's a pretty niche case.

The changed code is viewable on GitHub

Any thoughts or suggestions for the regex before I create the PR?

I'm assuming that if I create a PR, and if they accept it, they'll (eventually) release a version with it in, and the line in pyfedi's requirements.txt can get version bumped. This seems like the 'proper' way to do it, but it's a bit long-winded, so maybe there's a better way to do it.

andrew_s,
@andrew_s@piefed.social avatar

Woah. The PieFed theme and the Trans Pride theme are now the same, apparently.

rimu,
@rimu@piefed.social avatar

Yeah, it's just for today.

rimu,
@rimu@piefed.social avatar

It would be great to support Lemmy's spoiler tag, somehow.

Sorry, I'm terrible at regex. I tried putting that regex into https://regex101.com/ to test it but couldn't get it to match anything.

Markdown already has a syntax for spoilers, which Lemmy devs ignored. So if I were the Markdown2 maintainer I would not accept this PR as adding special tags only used by one project which duplicate existing functionality, would increase code complexity and extend the spec for no gain.

You could submit the PR anyway and see what happens.

In the meantime, I think we're going to have to "do it ourselves". Please see https://codeberg.org/rimu/pyfedi/commit/274cd536b297c78cd97c215e80f7bd64183e7364 for a suggested path forwards.

andrew_s,
@andrew_s@piefed.social avatar

I'll see what happens PR-wise. I thought it might be okay, because there's already a Telegram-specific spoiler extra in there (which I copy/pasted most of for the Lemmy one). I realise that Telegram is less niche than Lemmy, but there's apparently no standard Markdown for spoilers, just a couple of versions that big sites have popularised. (they seem to have been debating the matter for about a decade to get to a standard).

andrew_s,
@andrew_s@piefed.social avatar

I used Regex101 too (it works for me!)

https://i.postimg.cc/xTbRy6mB/Clipboard01.jpg

  • All
  • Subscribed
  • Moderated
  • Favorites
  • piefed_meta@piefed.social
  • kavyap
  • ngwrru68w68
  • Durango
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • khanakhh
  • slotface
  • everett
  • vwfavf
  • rosin
  • osvaldo12
  • megavids
  • GTA5RPClips
  • ethstaker
  • tacticalgear
  • InstantRegret
  • cisconetworking
  • cubers
  • tester
  • anitta
  • modclub
  • Leos
  • normalnudes
  • provamag3
  • JUstTest
  • All magazines