-
Notifications
You must be signed in to change notification settings - Fork 1
docs: overhaul README for v6 with API reference and collaborative editing focus #45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
30d5dc1 to
9a6d1b2
Compare
9a3863d to
a946a6a
Compare
9a6d1b2 to
e226529
Compare
c43b27c to
1dd9b82
Compare
e226529 to
5e84e17
Compare
README.md
Outdated
| - If the target string is below 30 characters long, don't use DMP | ||
| - If the generated DMP is greater than 1.2 times larger than the target string, don't use DMP | ||
| - **Document size limit**: Documents larger than 1MB use `set` operations | ||
| - **Change ratio threshold**: If >40% of text changes, uses `set` (indicates replacement vs. editing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to read the PR to figure this one out; this isn't about how much a string has changed, but about how much the difference in length the string has. Did you determine that this was significant enough to warrant this behavior? I'm curious on prepend/append operations (eg paste something new at the end) whether it would be preferable to use a DMP, if performance is reasonable enough.
| - **Change ratio threshold**: If >40% of text changes, uses `set` (indicates replacement vs. editing) | |
| - **Change ratio threshold**: If length of text changes >40%, uses `set` (indicates replacement vs. editing) |
5e84e17 to
86994be
Compare
1dd9b82 to
9223d1e
Compare
f825413 to
3749d93
Compare
9223d1e to
dcdbff0
Compare
…ting focus - Add objectives section highlighting conflict-resistant patches and performance - Add comprehensive API documentation for diffPatch() and diffValue() - Add collaborative editing example showing 3-way merge scenarios - Add technical details section covering diff-match-patch selection criteria - Document performance rationale based on @sanity/diff-match-patch testing - Remove v5 configuration options, add migration notes - Restructure as developer-friendly reference documentation
dcdbff0 to
1b89ce3
Compare
3749d93 to
befec5f
Compare
removes the mislead "document size" terminology as this is wrong. strings are not the full document and that isn't considered
1b89ce3 to
5d3c642
Compare
Merge activity
|

This PR is the first in a series of changes for the upcoming v6 release of
@sanity/diff-patch. It introduces a comprehensive overhaul of theREADME.mdto better reflect the library's capabilities, particularly its focus on generating conflict-resistant patches for collaborative editing environments, and to provide clearer, more developer-friendly documentation.Key Changes to the README:
diffPatch(source, target, options?), clarifying parameters (usingsourceandtarget) and options.diffValue(source, target, basePath?)function, allowing patch generation for arbitrary values without a document wrapper. Includes examples for both.diffPatchpreserves user intent and minimizes conflicts in a scenario where two users simultaneously edit different aspects of the same document (one reorders paragraphs and fixes a typo, while the other improves text content). The example shows how both sets of changes can be successfully merged.diff-match-patch:diff-match-patchvs. a simpleset(document size limit, change ratio threshold, small document optimization, system key protection).@sanity/diff-match-patchlibrary.lengthThresholdAbsoluteandlengthThresholdRelativeoptions fordiffMatchPatchhave been removed in v6 in favor of new, tested defaults that provide consistent performance._key) and index-based arrays are diffed, and howundefinedvalues in arrays are converted tonull._id,_type,_createdAt,_updatedAt,_rev) that are ignored during diffing._type, multi-dimensional arrays, invalid revision).Motivation:
The primary motivation for this overhaul is to prepare for the v6 release by:
This updated README aims to be a valuable resource for anyone using
@sanity/diff-patch, especially as we move towards v6.