Converts ANSI codes to HTML tags.
sudo gem install harleytt-ansitags
An example of converting a diff file with ansi color codes to HTML with color css
$ git show master --color | ansitags
"\e[92m\e[1mgreen bold text\e[0m".ansi_to_html => "<pre><span style="color: #00FF00"><span style="font-weight: bold;">green bold text</span></span></pre>"
That's basically it. ANSI Tags is capable of converting nearly all the ANSI codes mentioned on Wikipedia under “SGR (Select Graphic Rendition) parameters” except “Intensity: Faint”, Blink: Slow“, ”Blink: Rapid“, ”Underline: Double“, ”Blink: off“, and ”Image: Positive“. But you won't need any of them, so that's fine.
Fork the project.
Make your feature addition or bug fix.
Add tests for it. This is important so I don't break it in a future version unintentionally.
Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
Send me a pull request. Bonus points for topic branches.
Copyright © 2010 David Trasbo. See LICENSE for details.