Diff
ProSplits prose into words, keeping the whitespace and punctuation between them.
Preview
It's types and helpers, listed below.
Install
With the Candor CLI
First time? Get started sets up the registry and theme. Or with shadcn directly: npx shadcn@latest add @candor/diff
Functions
tokenizeWords(s: string)Splits prose into words, keeping the whitespace and punctuation between them.
diffTokens(a: string[], b: string[])A token-level diff (longest common subsequence). Adjacent ops of the same kind are merged. Falls back to one delete and one insert for very large inputs rather than spending quadratic time.
Types
- DiffOp
{ op: "eq" | "del" | "ins"; text: string }