Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Markdown differences #449

Open
liamwhite opened this issue Aug 2, 2024 · 2 comments
Open

Markdown differences #449

liamwhite opened this issue Aug 2, 2024 · 2 comments

Comments

@liamwhite
Copy link
Contributor

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
image

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?

@gjtorikian
Copy link
Collaborator

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?

@liamwhite
Copy link
Contributor Author

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants