Marked ranges seem similar to a doc.markText in Codemirror. As I understand it, the mark text will be lost when saving the document, so one needs to save all the marked text ranges at the time of document saving and then restore them when the document is loaded, correct? Also, I would want to attach an ID or data attributes so that I can attach click events, find their on-screen position, etc. . I think I saw somewhere in some thread that you mentioned that if one hands an unknown option name to markText, it will turn into an attribute of the DOM element that will be used to style the marked text. Is this correct and is this also the way to do it in Prosemirror?
One of the use cases for this is threaded commenting system where the comments are displayed to the right of the document but as far as possible are aligned vertically to the text they are referring to. Similar to many of the standard word processors. The commenting system probably has to be independent of the text editor, but it would be good if one could refer to such an identifier in order to move the comment if the text it refers to moves. Also, when a user clicks on a comment, it could highlight the part of the text that the comment refers to, etc.