I used to use
DOMSerializer to get HTML that generated by prosemirror. But I found there’s some problems:
- If dom is rendered by nodeView, the generated HTML will take value in
toDOMwhich may have difference with dom generated in nodeView.
- Sometimes there’re decorations in dom. Which is very common if we want to add highlight for codeblock using shiki or prism.
DOMSerializercan’t keep the dom structure with decorations.
So, let’s say I’m using prosemirror as an blog editor. I want to save HTML that can be used to render blogs for users. What’s the recommand way to do this?