开发者

Convert raw diff file to colorized html output

开发者 https://www.devze.com 2023-01-18 08:08 出处:网络
Does anyone know of a script that can accept a raw diff file and pretty print HTML output (which would be easier to review/mail)? A google search returned me some results like http://kafka.fr.free.fr/

Does anyone know of a script that can accept a raw diff file and pretty print HTML output (which would be easier to review/mail)? A google search returned me some results like http://kafka.fr.free.fr/diff2html/

However all of these scripts require two files as开发者_运维百科 input (they don't even accept two directories). My diff output is the diff between two svn branches


I finally used diff2html.py to create static html output of a side-by-side diff, given my unified diff intput


You might be interested to cdiff, a term based tool to display side by side, incremental, and colorful diff, the design is exactly to take unified diff from stdin or revision controlled workspace.

You can just send raw diff for review if your peer is using cdiff too.

PS: I am the author of coderev and cdiff, I know cdiff is better in both design and quality :)


I've just found coderev. This might worth a try...


I would try a syntax highlighter, e.g. pygments handles diffs just fine.


The best option for me is aha (Ansi HTML Adapter - https://github.com/theZiz/aha)

$ svn diff | colordiff | aha > /tmp/diff.html


With the evolution of diff and the existence of "aha", it's pretty simple now.

diff -y --color=always input1.tsv input2.tsv | aha --black > output.html

I also found this on https://unix.stackexchange.com/a/45390/378998

0

精彩评论

暂无评论...
验证码 换一张
取 消