Come aggiungo il supporto per l'editor di rich text alla mia estensione markdown?

I’ve created an extension that adds some bbcode tags to render snapblocks. When the rich text editor was introduced, this kind of broke my extension, or at least it’s unusable with the rich text editor. I want to add support for the rich text editor, so I looked into the spoiled extension to see how that does it, and I’ve currently got it somewhat working. I can actually insert the snapblocks into the post in the rich text editor, but I can’t seem to get existing snapblocks tags to convert to the rich text editor.

Here’s what I’ve got so far.

Right now I’m specifically focused on the actual conversion. I have a basic guess on how it works, but so far I’m not getting any results. So how do get the parsing to work?