views:

234

answers:

3

What is the standard Rails plugin for syntax highlighting (in a website admin panel for example, not for TextMate) that works right out of the box in a Rails project?

+4  A: 

I have been using CodeMirror. Not quite a plugin, but still very straight forward to integrate with Rails.

Toby Hede
+1  A: 

We use highlight.js on http://giantrobots.thoughtbot.com (isn't a Rails app, but whatever), and it's awesome.

http://softwaremaniacs.org/soft/highlight/en/

qrush
+1  A: 

I've seen many different ways for code highlighting in the Rails community.

  • The GitHub crew loves Pygments. They are using it on many different places, including Jekyll and GitHub itself. The downside is that it's a python library so you would need to install python and execute it as a shell task.
  • SyntaxHighlighter is an other popular, JavaScript based solutions. This is the one adopted by WordPress and Yahoo! There are many different Rails plugins for this even if the integration doesn't actually require a plugin.
  • Ruby offers 3 code highlighting Gems: Ultraviolet, Syntax and CodeRay. AFAIK, the last one is the most adopted.

I tried all those solutions in the past. I'm actually using Pygments for a couple of Jekyll blogs and JavaScript based solutions in all the other cases.

Simone Carletti