Delta – Track Contents & Changes, Operational Transform in Elixir

Delta :zap:

An expressive format to describe documents’ contents and how it changes over time :card_file_box: :hourglass_flowing_sand:

The Delta format is a strict subset of JSON, is human readable, and easily parsible by machines. Deltas can describe any rich-text document, includes all text and formatting information, without the ambiguity and complexity of HTML.

It is also suitable for Operational Transform and can be used in real-time, collaborative document editors (e.g. Slab, Google Docs). A walkthough of the motivation and design thinking behind Deltas are on Designing the Delta Format.

While the package is still v0.1.0 on Hex.pm, we’ve been using it in production for almost 4 years before we open-sourced it, so we’re very confident in our implementation. Feel free to drop any feedback or questions you might have!

25 Likes

That looks incredibly useful :slight_smile:

Thanks for the hard work.

1 Like

@sheharyarn If I may offer some constructive feedback, I think the lack of any documentation is going to be an obstacle for a majority of people to try this out.

I mean that in the kindest way possible! :heart:

My curiosity was piqued by your post, but when I went to look in HexDocs all of the functions were completely undocumented and there wasn’t a main page that said anything about the project.

I’d love to learn more about what the project does without having to dig through the codebase. :sweat_smile:

Edit: Just realized that there is some information available in the README on GitHub.

1 Like

You’re absolutely right. We’re still working on the docs at the moment, but OT itself is such a complex subject, that I believe it’s better to use real-world examples to show how it works and the different pieces connect.

I recently published a post that gives an overview of some of the features and how they can be used:

I’m currently working on another post that will dive into more detail into the real-time collaboration part using Phoenix channels.

6 Likes

This looks awesome!

Out of curiosity, how do you render this content? Like, do you render this to HTML using Quill in javascript or do you have different ways to render this content on the server to a particular target such as HTML?

For example I think flutter has a library to render quill’s format which I think this mirrors? So I’m wondering if you render this in a way that a client can display it client-side only or also on the server?

2 Likes

On the frontend, we do in fact use Quill to render the content. We don’t prerender it on the server, and keep the format as-is to for receiving changes, transforming the contents and sending it to clients.

2 Likes