How to syntax highlight code in your view System-file-manager plugins - suggested by Soleone, 3 months ago

Use the Highlight_Fu plugin

1. Installation – Get the plugin via:

ruby script/install plugin http://highlightfu.googlecode.com/svn/trunk

2. Copy required Javacript and CSS to your public folder – This is easily done with the following Rake task:

rake highlight_fu:install

3. View (requirements) – Include the javascripts and CSS from your view (normally the layout):

4. View (requirements 2) – You also need to add the following line at the end of your view file to make it work:

5. View – Now let’s highlight our code (the code needs to be inside a pre-block set to the programming language, e.g. Ruby:

Note: You can also specify some options to modify the appearance of the source code. The following example will hide the line numbers and hide the links for additional controls:

Done

This is how I highlight the ruby code on this page. It looks like this:

Applications-internet Go here for additional information: http://www.munitic.com.hr/2007/7/5/highlightfu-syntax-highlighting-plugin


1 Comment

(posted by Anonymous, 2 months ago)

pretty

Title (optional)

Text (Textile is active)


Back to all Tips