Getting markdown content on collab server #1394
Unanswered
VincentK-ZA
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When using the collab plugin, it relies internally on the y-prosemirror project, meaning the content synced into the yjs doc is an xml fragment.
i.e. if my markdown content is:
# hello world
then
yDoc.getXmlFragment("prosemirror").toJSON()
will give:Is there an easy way to get the markdown content on the server running the yjs connection provider?
I've currently got something working in a very hacky way, whereby I create an instance of the Milkdown editor on the nodejs + express server, relying on jsdom
So I setup jsdom once and create the editor once.
I can then use the
serializer
andschema
to create the markdown from theyXmlFragment
So this works, but I'm sure there must be a way to setup the necessary plugins and create the serializer and schema only, without needing the view.
The reason for needing this functionality is since we'd like to only work with the markdown as a source of truth, and have the server periodically persist the markdown to a nosql database.
I do realize that we would need to ensure that the plugins used on the frontend match those on the backend, else content may get lost.
Beta Was this translation helpful? Give feedback.
All reactions