A port in Go of ProseMirror for writing a collaborative editing server

Hello,

I works for Cozy Cloud, a personal cloud (Open-Source), and we are writing an app based on ProseMirror for taking notes. The notes can be shared, and the collaborative features of ProseMirror were important to us. The server code is written in Go, and the solution we have chosen is to port some ProseMirror components, so that we can have the collaborative features with a server in Go.

The code is available here: https://github.com/cozy/prosemirror-go. It covers a very large part of prosemirror-model, something like half of prosemirror-transform, and a bit of prosemirror-markdown (markdown is more of a bonus that something necessary for collaboration).

I hope it can be useful to other coders. Feel free to open issues for bugs or things that can be improved. And I’d like that ProseMirror (the original in JS) is really well coded, it was really a pleasure to read it and transform the code in Go.

Nice, thanks for sharing. Porting some of the hairy parts of prosemirror-transform (specifically the replace-step-fitting stuff in src/replace.js) and keeping it in sync with upstream bugfixes sounds daunting. But maybe you don’t need to do that, since you get your steps already-fitted from the client.

Yes, we let the clients do the complicated stuff on the steps and we didn’t need to recode the replace-step-fitting in src/replace.js. The server can apply the steps from one client to allow a new client to start from the latest version, but if the steps can’t be applied, it’s the client that must resend the steps for the new version.