G+: Was looking for a quick and easy way …

David Coles
Was looking for a quick and easy way of pretty-printing a diff as a HTML file. Typically I've used enscripten for all my pretty-printing purposes, but sadly the HTML output highlights added and removed lines the same colour.

While not quite as nice for doing printed output, it really shines for console and HTML use with a large selection of highlighters, preprocessors and colour themes. Be sure to check it out.

Pygments — Python syntax highlighter


(+1's) 1
Matt Giuca
Funny, this was my first solo open source project: http://sourceforge.net/projects/diffh/
I wouldn't recommend it: it's written in C, probably quite buggy, and difficult to use. But there you go ;)

Does Pygments print diffs? Or does it just nicely syntax-highlight a context diff for HTML?

There's also Python's difflib:
http://docs.python.org/library/difflib.html
Which I'm sure could easily be wrapped as a command-line tool.

David Coles
It has a few different outputs including console, 256-colour console, RTF, TeX and HTML (either as a HTML fragment or a full page). It's also quite extensible, so you can easily write new backends. About the only thing it doesn't do well is producing PDF or postscript for printing.

For example, you could use `pygmentize -ldiff` as an alternative to `cdiff`. Python also has a command line version of difflib included in the standard documentation which isn't bad.

Matt Giuca
"About the only thing it doesn't do well is producing PDF or postscript for printing."
Isn't that Latex's job, after Pygments spits out a Tex file?

David Coles
Probably, yes (I wasn't able to get it working in my quick test at work). I still think Enscripten is a better tool for paper copies (pretty printing, 2-up, titles, colour, footers and a whole bunch of other nice print formatting options).