Peritext: A CRDT for Collaborative Rich Text Editing
Geoffrey Litt, Sarah Lim, Martin Kleppmann, Peter van Hardenberg
Abstract
Conflict-Free Replicated Data Types (CRDTs) support decentralized collaborative editing of shared data, enabling peer-to-peer sharing and flexible branching and merging workflows. While there is extensive work on CRDTs for plain text, much less is known about CRDTs for rich text with formatting. No algorithms have been published, and existing open-source implementations do not always preserve user intent.
In this paper, we describe a model of intent preservation in rich text editing, developed through a series of concurrent editing scenarios. We then describe Peritext, a CRDT algorithm for rich text that satisfies the criteria of our model. The key idea is to store formatting spans alongside the plaintext character sequence, linked to a stable identifier for the first and last character of each span, and then to derive the final formatted text from these spans in a deterministic way that ensures concurrent operations commute.
We have prototyped our algorithm in TypeScript, validated it using randomized property-based testing, and integrated it with an editor UI. We also prove that our algorithm ensures convergence, and demonstrate its causality preservation and intention preservation properties.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext c7c05a70-8d5d-4915-a3c0-858c7dde2cfeCited by top-tier papers5
- Expressive Text-to-Image Generation with Rich TextSongwei Ge, Taesung Park, Jun-Yan Zhu, Jia-Bin HuangICCV 2023 · 102 citations
- Semantic Commit: Helping Users Update Intent Specifications for AI Memory at ScalePriyan Vaithilingam, Munyeong Kim, Frida-Cecilia Acosta-Parenteau, Daniel Lee et al.UIST 2025 · 5 citations
- Grove: A Bidirectionally Typed Collaborative Structure Editor CalculusMichael D. Adams, Eric Griffis, Thomas Porter, Sundara Vishnu Satish et al.POPL 2025 · 3 citations
- Denicek: Computational Substrate for Document-Oriented End-User ProgrammingTomas Petricek, Jonathan EdwardsUIST 2025 · 2 citations
- Acumen: A Platform for Encrypted and Accountable Collaborative EditingRyan Cottone, Darya Kaviani, Conor Power, Will Giorza et al.OSDI 2026
Related papers
- Collaborative Text Editing with Eg-walker: Better, Faster, SmallerJoseph Gentle, Martin KleppmannEuroSys 2025 · 3 citations
- Type-Checking CRDT ConvergenceGeorge Zakhour, Pascal Weisenburger, Guido SalvaneschiPLDI 2023 · 16 citations
- Keep CALM and CRDT OnShadaj Laddad, Conor Power, Mae Milano, Alvin Cheung et al.VLDB 2023 · 13 citations
- Abstraction for conflict-free replicated data typesHongjin Liang, Xinyu FengPLDI 2021 · 9 citations
- Composing CRDTs Convergent by ConstructionAlexander Städing Dominguez, George Zakhour, Pascal Weisenburger, Guido SalvaneschiOOPSLA 2026
