Is there some way to serialize the document to plain text?

With the newest documentation I finally understood how to set things up and how everything works, but I can’t find anything about how to get just the text of the document without all the html tags, just newlines at paragraphs?

Is this possible or what would be the best way to go about this. At first I thought of just turning the dom node to a string then stripping the tags, but I feel that would get slow with bigger documents. Then I remembered the markdown serializer. It shouldn’t be too hard to edit it to return plain text, but I just want to check before I started modifying it that I wasn’t missing anything obvious.

1 Like

Take a look at https://prosemirror.net/docs/ref/#model.Node.textBetween (use "\n\n" as the block separator).

3 Likes