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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃殌 output using html <ins> and <del> tags #1703

Open
frivoal opened this issue May 13, 2024 · 0 comments
Open

馃殌 output using html <ins> and <del> tags #1703

frivoal opened this issue May 13, 2024 · 0 comments

Comments

@frivoal
Copy link

frivoal commented May 13, 2024

When the old and new files being compared are HTML (or markdown), it would be convenient to have the ability to opt into a mode where the output is the original file, with the differences marked with the html <ins> and <del> elements.

For example:
Old:

<!doctype html>
    <p>Hello wrodl.

New:

<!doctype html>
    <p>Hello world.

Output:

<!doctype>
    <p>Hello <del>wrodl</del><ins>world</ins>.

Since git-delta already has the ability to detect word-level diff, it seems this could be achievable.

The reason why this would be useful is that when making changes to human readable documents, the source diff isn't always the most user-friendly, and a rendered diff can make life much easier for reviewers.
There already exist a number of standalone htmldiff tools, but:

  • none of them have the git integration that git-delta has, which makes them much less convenient
  • many of them tend to mangle the source formatting in various ways, destroying formatting / spacing / line breaking along the way, in a way that a real diff tool wouldn't do.

I guess the biggest challenge is that this would need some degree of syntax awareness, to avoid injecting tags in the middle of html attributes or other invalid locations.

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

1 participant