difftastic icon indicating copy to clipboard operation
difftastic copied to clipboard

Feature request: More granular diffs in (X)HTML

Open acabal opened this issue 3 years ago β€’ 2 comments

At Standard Ebooks, we work with ebooks in XHTML format. Since our books are typically prose novels, a single line of source code can be a very long <p> element, for example:

<p>To which Don Quixote replied, β€œThou must take notice, brother Sancho, that this adventure and those like it are not adventures of islands, but of crossroads, in which nothing is got except a broken head or an ear the less: have patience, for adventures will present themselves from which I may make you, not only a governor, but something more.”</p>

We often make small changes to lines, like adding or removing a single character to fix a typo. In a typical diff situation, this is hard to see because the line is so long and a "change" highlights the entire line. This also appears to be the case with Difftastic, in which changing one character in a long <p> will highlight the entire contents of the element, instead of just the addition/deletion.

In regular git, we usually have to invoke git diff -U0 --word-diff-regex=. to get the kind of diff that's actually helpful, but that's not syntax-aware or very pretty. Would it be possible to have Difftastic highlight changes within (X)HTML text nodes in a more granular manner?

acabal avatar Jul 05 '22 20:07 acabal

Possibly related to #178

acabal avatar Jul 05 '22 20:07 acabal