kpdecker / jsdiff

A javascript text differencing implementation.
BSD 3-Clause "New" or "Revised" License
7.92k stars 496 forks source link

Can we ignore specific characters like *,\ etc using diffWords ? #403

Closed OmkarPh closed 7 months ago

OmkarPh commented 1 year ago

I don't want the following to be detected as a diff. Ignoring the * before & after this word should do the trick ig (I don't want to track special characters in my diff anyway) image

Is there any way to achieve this? I'm using diffWords here btw

ExplodingCabbage commented 7 months ago

Not trivial current way, and I don't think I'd want to add it, but https://github.com/kpdecker/jsdiff/issues/221 is a similar request and might give you the results you want here (if/when I implement it).

The one thing you can currently do is roll your own tokenization and equality-checking logic to get the behaviour you want.