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.