A Rust and TypeScript library for merging conflicting text edits without manual intervention. http://schmelczer.dev/reconcile
Find a file
2025-07-04 03:16:15 +01:00
.github Add dependabot for JS 2025-07-04 03:14:27 +01:00
.vscode Update ignores 2025-07-04 03:16:15 +01:00
examples/website Use wrapper in example 2025-07-04 03:09:11 +01:00
reconcile-js Rename TextWithHistory to SpanWithHistory 2025-07-04 03:14:18 +01:00
scripts Use wrapper in example 2025-07-04 03:09:11 +01:00
src Rename TextWithHistory to SpanWithHistory 2025-07-04 03:14:18 +01:00
tests Fix wrapping 2025-07-04 02:16:17 +01:00
.editorconfig Update editorconfig 2025-04-04 21:58:32 +01:00
.gitignore Update ignores 2025-07-04 03:16:15 +01:00
Cargo.lock Add wee_alloc 2025-07-03 16:41:33 +01:00
Cargo.toml Add wee_alloc 2025-07-03 16:41:33 +01:00
README.md Add more docs 2025-07-04 03:15:43 +01:00
rust-toolchain.toml Move files 2025-06-15 11:08:28 +01:00
rustfmt.toml Move files 2025-06-15 11:08:28 +01:00

Reconcile: conflict-free 3-way text merging

diff3 but with automatic conflict resolution.

Features

  • Conflict-free output (no more git conflict markers like in )
  • Support for updating cursor/selection positions
  • Pluggable tokenizer
  • Full UTF-8 support
  • WASM

Motivation

Sometimes documents get edited concurrently by multiple users (or the same user from multiple devices) resulting in divergent changes.

To allow for offline editing, we could use CRDTs or Operational Transformation (OT) to come to a consistent resolution of the competing version. However, this requires capturing all user actions: insertions, deletes, move, copies, and pastes. In some application, this is trivial if the document can only be edited through an editor somehow in our control. But this isn't always the case. Users enjoy composable systems that don't lock them in. For example, one of the unique selling points of Obsidian is to provide an editor experience over a folder Markdown files leaving the user free to change their technology of choice on a whim.

This means that files can be edited out-of-channel and the only information a text synchronisation system can know is the current content of each tracked file. This is the same problem as what Git and similar version control systems solve. Although the problem is similar, there's a relevant difference between syncing source code and personal notes: in the case of the former, a semantically incorrect conflict resolution can wreak havoc in a code base, or worse, introduce a correctness bug unnoticed. Text notes are different though, humans are well-equipped to finding the signal in a noisy environment and "bad merges" might result in a clumsy sentence but the reader will likely still understand the gist and can fix it if necessary.

There are domains of human text which are less tolerant of mis-merges: for instance, a two conflicting changes to a contract could result in a term getting negated in different ways from both sides, resulting in a double-negation, thus, unknowingly changing the meaning.

VaultLink self-hosted Obsidian plugin for file syncing

Check Publish to GitHub Pages

Develop

Install nvm

  • curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash
  • nvm install 22
  • nvm use 22
  • Optionally set the system-wide default: nvm alias default 22

Set up Rust

  • Install rustup: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Install wasm-pack: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
  • cargo install cargo-insta sqlx-cli cargo-edit

Install Obsidian on Linux

apt install flatpak
flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo
flatpak install flathub md.obsidian.Obsidian
flatpak run md.obsidian.Obsidian

Scripts

Update HTTP API TS bindings

scripts/update-api-types.sh

Publish new version

scripts/bump-version.sh patch

Run E2E tests

scripts/e2e.sh

And to clean up the logs & database files, run scripts/clean-up.sh

Projects

npm install -g typescript