Collaborative editors enable multiple authors to simultaneously edit documents. However, most do not support asynchronous collaboration wherein users work on a private copy of a document before subsequently sharing their updates. In this post, Geoffrey Litt and a team from Ink & Switch present Peritext, a Conflict-free Replicated Data Type (CRDT) algorithm that enables users to adopt a branching and merging workflow when editing documents. Peritext guarantees that upon merging independently, users will converge towards the same merged result. The authors explain the algorithm, including how it can preserve user intent in rich-text editing, and demonstrate a prototype implementation in Typescript, which extends their Automerge CRDT library.