You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A way to just get the inline additions / deletions? #72
If you diff two strings that rarely have newlines or none at all, how would you avoid duplicating a lot of text in the unchanged part? Especially in the HTML output? Any hints on this?
For example:
"This is my string which has a lot ofsome text but no newlines and only a very small fraction of information is changed"
Reacted by Abraão Miranda, Tiago Amaro, Michaël Hoste, Jaye Hackett and Ryan Bates
There's isn't a clear cut way to do that with the current functionality, though there's some extensibility built in to create custom output formats. I do think there's a common desire for this, for folks looking to diff minimized JS, CSS, etc. so I'd happily review a pull request if you find a generic way to do this.
In terms of addressing your problem in the short term I can see two reasonable ways you could accomplish this in the short term.
Preprocess your input. For example, assuming this is minimized js you're diffing, convert all the ; to ;\n so that you can see line-by-line diffs. This stackoverflow answer talks a bit more about this approach.
Postprocess the output. It might also be resonable to take diffy's html output and scan it for the <strong> tags that represent inline changes. This isn't super clean but depending on your use case it could be part of an acceptable solution.
Activity
[-]A waay to just get the inline additions / deletions?[/-][+]A way to just get the inline additions / deletions?[/+]samg commentedon May 30, 2016
There's isn't a clear cut way to do that with the current functionality, though there's some extensibility built in to create custom output formats. I do think there's a common desire for this, for folks looking to diff minimized JS, CSS, etc. so I'd happily review a pull request if you find a generic way to do this.
In terms of addressing your problem in the short term I can see two reasonable ways you could accomplish this in the short term.
;to;\nso that you can see line-by-line diffs. This stackoverflow answer talks a bit more about this approach.<strong>tags that represent inline changes. This isn't super clean but depending on your use case it could be part of an acceptable solution.