Hello, I’ve been tasked with writing a parser/serializer that can take documents in a proprietary format as input and output Prosemirror markup. I was wondering if anyone else has tried to assemble Prosemirror markup outside of an editor state context?
I was thinking that the easiest thing to do would be to build an intermediate HTML tree such that running it through a DOMParser will produce the expected result, but taking that intermediate step kind of rubs me the wrong way.
The other idea I had was to build the markup upside-down, starting with the leaf nodes and using
NodeType.create(content) to build the tree up to the document root.
Do I have the right idea here or is there an easier way that I’ve missed?