-
-
Notifications
You must be signed in to change notification settings - Fork 313
Add support for various JsDiff text comparison methods #51
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
Add support for various JsDiff text comparison methods #51
Conversation
1d3b224 to
e53a882
Compare
|
Hi @circAssimilate, thanks for this. This is really useful. I'll take a look at this over the weekend. Thanks again. |
praneshr
left a comment
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.
LGTM. Can you check the PR comments and fix them. I'm planning to include this change in the upcoming v3.0
|
Thanks for the review, @praneshr. I'll aim to get to this today! |
|
@praneshr, all ready for another review when you get the chance. 🎩👌 |
|
@praneshr, out of curiosity, do you have a rough timeline of when the 3.0.0 release will happen? We're doing some internal planning and I was hoping to communicate some expected timelines. |
|
@circAssimilate I'm so sorry for the delay. v3.0 will be out by Dec 8th. I'll merge your PR with my changes. Till then, you can use the forked module. |
|
Sounds good, thank you! |
|
@circAssimilate Thanks for the contribution. Merging this to master. It will be released with v3 |
|
Thank you for the support and review, @praneshr! |
This PR is heavily inspired by #31, but differs slightly in it's approach. This is required functionality if we're going to be able to use react-diff-viewer in our product. Today, the default text diff comparison looks like this:
But it would be more desirable for the implementer to be able to specify which JsDiff method is used, creating a more desirable diff in cases like this:
Because the proposed
jsDiffCompareMethodprop has a default value ofdiffChars, this would be a backwards compatible and a non-breaking change.disableWordDiffwould still exist as a different prop and we'd simply return early if an unrecognized method name was passed.In summary, this PR will:
Some other improvements worth considering in this or subsequent PRs:
Run this locally:
(NOTE: this node version works for me but someone should probably add
.nvmrcwith ideal node version)Totally open to feedback and very interested in helping push this over the line!