20261204-A git-style diff view for PublicTxt Remotes
The Obsidian PublicTxt Remotes Plugin lets you follow other people’s PublicTxt repos and fork pages from them into your own vault. A fork records where it came from in its front matter, so when the original changes, the plugin can tell you.
Then you have to decide what to do: Overwrite your copy with the new version, Write alongside it, or Keep mine. Until now, the compare view gave you a line count (“12 lines added, 3 removed since you forked”) and upstream’s page, rendered. That was enough to know something had changed, but not what had changed. You had to read both versions side by side and spot the differences yourself.
So compare now has a diff, the kind you’d expect from a git client.
What it looks like

The Upstream view, which opens beside your note, now has a switch: Changes, Rendered or Source. Changes is the default, and it shows:
- old and new line numbers, removed lines in red, added lines in green
- the words that changed inside a line, marked in a stronger shade
- three lines of context around each change, with longer unchanged stretches folded into a bar you can select to open
- a +12 −3 count beside the switch
- a choice of layout: Inline, one column like a patch, or Side by side, the old version on the left and the new on the right, with removed lines lined up beside the lines that replaced them. The view sits beside your note and is usually narrow, so inline is the default; widen the pane or pop it out to its own window and side by side has room. Whichever you pick is remembered.
It offers two comparisons:
- Upstream changes: the version you forked, against the new one. What did they change?
- Yours → upstream: your note as it is now, against the new version. This is exactly what Overwrite would do, so you can see what you’d lose before you choose. The plugin’s own
fork_*keys are left out, so they don’t show up as noise. It redraws as you edit the note beside it.
The diff is plain text, never rendered. A page someone else wrote can’t run anything or load anything from the web just because you looked at what changed in it. That fits the copy safety work from earlier this week.
Why word-level matters for notes
Code diffs work line by line, and code has short lines. Notes don’t: in Markdown, a whole paragraph is one line. Fix a typo in a paragraph, and a line diff marks the entire paragraph as removed and re-added. You’d still be hunting for the change.
So inside each block of changed lines, the plugin diffs again, word by word. Two refinements keep it readable:
- If two versions of a paragraph have little in common (under about a third), it doesn’t mark words at all. The paragraph was rewritten, and highlighting every other word is just noise.
- A small gap between two changes, only spaces or a single punctuation mark, is treated as part of the change. “the red car” → “a blue car” reads as one change, not three.
How it was built
CodeMirror’s merge view was out, because Obsidian doesn’t ship it, so it would have been a bundled dependency. So were the existing diff libraries, for the same reason. Instead it’s about 360 lines of TypeScript, borrowing ideas from git, VS Code and fast-myers-diff:
- Myers’ algorithm, the same family git uses, in linear memory, so a long file can’t crash it.
- A cost cap: two very different files show as replaced whole, rather than grinding away.
- Sliding: an added paragraph is placed so you see the paragraph you added, not half of two.
What’s next
- Merge. Git can combine three versions: the original, yours and theirs. That would give a fourth choice next to Overwrite, Write alongside and Keep mine: keep your edits and take upstream’s.
The diff is merged into the plugin and will ship in the next release. The full details are in the compare docs.