Markdown differences
liamwhite opened this issue · 4 comments
GitHub supports a "difference mode" in its Markdown support. This can be demonstrated e.g. on this repository here by selecting the "Rich diff":
Capture |
---|
The difference algorithm seems to be at least vaguely syntax-aware, so this isn't necessarily handled on its own by just a Myers diff. Is it possible for comrak to support such a difference mode?
I actually worked on this feature when I was at GitHub. It's not a complicated process; I vaguely remember it being a process where the before and after nodes of the HTML trees were walked, with a diff on children that were added or removed.
I don't know whether comrak should support this natively per se, but one can already walk through the AST on their own. Would a code sample showing that be helpful? How would you ultimately use this feature?
A code sample would be very helpful, yes. :)
My ultimate plan is to use it in a similar way to how GitHub uses it, for highlighting differences between different versions of forum posts/comments,