# Diff tool in Ruby with HTML output

**URL:** <https://www.ruby-forum.com/t/diff-tool-in-ruby-with-html-output/159789>\
**Category:** Rails\
**Created:** [February 8, 2009, 9:24pm UTC](https://www.ruby-forum.com/t/diff-tool-in-ruby-with-html-output/159789 "2009-02-08T21:24:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![mauricio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/90db22/32.png) [@mauricio](https://www.ruby-forum.com/u/mauricio)\
**Post date:** [February 8, 2009, 9:24pm UTC](https://www.ruby-forum.com/t/diff-tool-in-ruby-with-html-output/159789/1 "2009-02-08T21:24:00Z")

</div>

Hello,

Anyone knows of any tool that can generate a diff between two files  
and output HTML code that i could use in a page?

Doesn’t need to be a Ruby tool, any Unix compatible tool would do the  
trick, I just need it to output HTML.

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)

---

<div class="post-metadata">

**Author:** ![mauricio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/90db22/32.png) [@mauricio](https://www.ruby-forum.com/u/mauricio)\
**Post date:** [February 9, 2009, 7:37pm UTC](https://www.ruby-forum.com/t/diff-tool-in-ruby-with-html-output/159789/2 "2009-02-09T19:37:51Z")

</div>

$ irb

> > `echo "testing 123\ntesting" > ./file1.txt`  
> > =\> “”  
> > `echo "testing 123\nhey, something new\ntesting" > ./file2.txt`  
> > =\> “”  
> > puts “
> > 
> > ```
> > diff -cws file1.txt file2.txt
> > ```
> > 
> > ”

```
*** file1.txt 2009-02-09 10:25:44.000000000 -0800
--- file2.txt 2009-02-09 10:28:31.000000000 -0800
***************
 ***1,2****
--- 1,3 ----
  testing 123
+ hey, something new
  testing
```
  
=\> nil

> >

Jeff

On Feb 8, 12:08 pm, Maurício Linhares [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![mauricio](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/90db22/32.png) [@mauricio](https://www.ruby-forum.com/u/mauricio)\
**Post date:** [February 9, 2009, 9:01pm UTC](https://www.ruby-forum.com/t/diff-tool-in-ruby-with-html-output/159789/3 "2009-02-09T21:01:51Z")

</div>

I was looking for something that could turn the diff output into nice  
HTML, but thanks anyway.

- 

Maurício Linhares  
[http://alinhavado.wordpress.com/](http://alinhavado.wordpress.com/) (pt-br) | [http://blog.codevader.com/](http://blog.codevader.com/)  
(en)
