I want to implement cross references in documents, such as latex like cross references,like this:
\subsection{rel section}\label{subsection1}
in \ref{subsection1} section, we show you how to reference a chapter in latex
I’m using prosemirror now, so I want to quote a figure, and my idea is to do this. Give this figure a unique ID, and record the ID in the referenced view,like this:
It sounds like these IDs would better be stored at the document level, rather than with decorations. See for example this thread for some related discussion.
Hey @milu2003,
in Fidus Writer (based on ProseMirror and with LaTeX export) we solved it by:
Checking for unique IDs at the time of figure creation (create random id, check if it is used already, if yes, create another and check again, etc.).
There is also some logic to check new content that appears for figures (and other items that have IDs). Those could have been copied/pasted from the same document and so we need to create an append transaction to give the inserted ones another ID.
There is a plugin that keeps track of all the items with IDs that are being linked to via cross-references. If the linked-to item has been removed, we add warning-signs to the cross-references telling the user that the item that is being linked to is no longer in the document.
This works well for single documents. Recently users have told us they also want to do cross references between multiple documents that are all currently being edited. I’m, not yet sure how one can address that.