ProseMirror with BBCode


I would like to use ProseMirror in order to implement relatively simple Editor for (a subset of) BBCode markup. I’m quite new to the ProseMirror and played a little with the examples and read the guide, but there is still a lot to learn. Could someone describe just top level picture of such implementation? For example if I have a BBCode formatted text at the start:

What would be the right way to parse it into a Schema/ is there some function in ProseMirror , which allows parsing the [ , ] tags or should I provide it myself or through 3rd part library?

After the edit is done how should the opposite transformation be done - from html DOM or from ProseMirror DOM to BBCode markup (as I would like to save the edited text again in BBCode format)

I’ve read about markups, decorations , transform objects - which ones are “proper” for these tasks?

Is ProseMirror alone the right tool for the task or is there a 3rd part library one would combine with the ProseMirror for that task?

Thanks a lot in advance!

The latter. You’d define a schema that covers all the constructs allowed by BBCode, and then a parser that creates documents in that schema given an input document.

You’ll need a custom serializer—a function that takes a document and outputs a BBCode string. These are usually quite easy to write.

1 Like