The side-by-side Markdown diff of this change (to the Recent feature changes) gets rather confused, because it decides to see some similarities in the new entry for 2016-06-30 to the old one, and thus fails to notice the relatively small changes after that (AFAIK to just remove the http: from the URLs).

Now, I know diff algorithms are hard to get right. (As I mention here, I use three different free diff programs, because they each have better displays for various scenarios.) However, the side-by-side display highlights only the new content for 2016-06-30 and the links.

Given my proviso above, I do hesitate calling this a , but it is more of a bug report highlighting an issue to be reviewed when possible, rather than a feature change request.


1 Answer 1


TL;DR: Fixed in the next build (this particular case, anyway).

Because of that answer's length, the Markdown diff is running in defensive mode. I'm giving an explanation of what that is (and why it's necessary) in this answer (that's about defensive mode when diffing HTML, but the problem is the same and the solution is similar).

When splitting the Markdown into tokens (think "words and punctuation") for diffing in this particular case, we end up with 2,607 tokens in revision 36, and 2,653 tokens in revision 37. Defensive diffing is enabled once the total number of tokens is above 4,000.

Defensive mode will then re-combine tokens into larger groups and compare whole groups instead of single tokens. Only neighboring changed groups are then compared token-by-token.

The re-combining of tokens mostly means grouping them line-by-line, with two additional provisions:

  1. consecutive whitespace is handled specially, so that indentation changes to code blocks are diff'ed nicely (this isn't relevant here), and
  2. underscores and asterisks are handled specially, because these formatting tags tend to work quite well for anchoring source and destination text together when we can't go word-for-word.

Because the answer in question (haha) has no bold or italics, point 2) doesn't help here. However, the answer has links, which also look like a good way to perform this anchoring, and so I've added square brackets to the characters that are handled specially as well.

This is what you complained about:

screenshot of the "before" diff with what looks like a lot of change

And this is what it looks like after this change:

screenshot of the "after" diff which makes it clearer that not much has changed

The usual disclaimers apply – this fixes this particular and similar cases, but (as you note yourself), there will always be diffs that are suboptimal.

  • That's working so well, there's now a need for "Can the side-by-side Markdown diff algorithm inform the side-by-side algorithm?" :-)
    – Mark Hurd
    Jul 14, 2016 at 2:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .