diff to html (diff2html) program

HtmlDiff

Html Problem Overview


I'm looking for a "diff to html" program, which would generate a static html page from a given diff/patch file.

I've googled for it of course, but apart from some scripts I've found there's no "real project" (e.g. no package in Debian/Ubuntu).

Have I missed something? Can you recommend anything?

Html Solutions


Solution 1 - Html

You can use [diff2html.py][1] that is able to create a side-by-side diff in a static html page, from an unified diff input. The script is written in python.

cat foo.diff | python diff2html.py > foo.html

[1]: http://wiki.droids-corp.org/articles/d/i/f/Diff2html.html "diff2html.py"

Solution 2 - Html

pygments has syntax highlighting for diff (and for lots of other languages), and can be used as a library or a command-line program. Is that the sort of thing you're looking for? If not please clarify the question...

Solution 3 - Html

Something along the lines of:

vim test.diff -c TOhtml -c ":saveas test.html" -c ":q" -c ":q"

works well, and you can change the color-scheme of the diff by changing the color scheme in vi.

Solution 4 - Html

Solution 5 - Html

Solution 6 - Html

Have you tried http://prettydiff.com/ as it ignores differences in white space and comments.

[Disclaimer: this is my site]

Solution 7 - Html

There's also 2html in Vim, which works very well, and it's built-in: it takes a file that Vim knows how to highlight its syntax, and creates an HTML with the correct formatting. To use it, just open the wanted file with Vim, and source the 2html script. It will open the converted file in a new buffer, which can be saved. Here:

vim example.diff

and then in Vim,

:so /usr/share/vim/vim72/syntax/2html.vim
:wqa

Solution 8 - Html

The best I've found that produces nice side-by-side diffs is this script:

http://tools.ietf.org/tools/rfcdiff/

Although it's designed to be used on RFCs it works with any text file.

This project also has nice output, but I'm not sure if it can be used without subversion: http://code.google.com/p/coderev/

Solution 9 - Html

I use http://www.emacswiki.org/emacs/Htmlize">htmlize</a> in Emacs. Doesn't come with Emacs, and assumes you're using Emacs. Relies on the syntax highlighting of Emacs's Diff mode. Only good for doing one file at a time. Does the right thing for me.

Solution 10 - Html

I found coderev, demo looks nice

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionblueyedView Question on Stackoverflow
Solution 1 - Htmlzer0View Answer on Stackoverflow
Solution 2 - HtmlpuetzkView Answer on Stackoverflow
Solution 3 - HtmlDaniel ZinnView Answer on Stackoverflow
Solution 4 - HtmlbitheadView Answer on Stackoverflow
Solution 5 - Htmlax.View Answer on Stackoverflow
Solution 6 - Htmlaustin cheneyView Answer on Stackoverflow
Solution 7 - HtmlDaniel HershcovichView Answer on Stackoverflow
Solution 8 - HtmlAndy LongwillView Answer on Stackoverflow
Solution 9 - HtmlashawleyView Answer on Stackoverflow
Solution 10 - HtmlrenView Answer on Stackoverflow