HighlightFu syntax highlighting plugin

Posted on Thu Jul 05 @ 00:27:56

HighlightFu

HighlightFu is a syntax highlighting plugin that adds helper methods to your views. It searches for a <pre lang=”[lang]>[code]</pre> html tag and replaces it with the syntax highlighting code. The syntax highlighting is done using dp.SyntaxHighlighter. I’ve developed HighlightFu because I was not satisfied with the previous syntax highlighting plugin I made.

Installation instructions


    script/plugin install http://svn.munitic.com.hr/plugins/highlight_fu

Usage

  1. run rake highlight_fu:install (this installs all necessary javascripts and stylesheets)
  2. include stylesheets and javascripts with
    <%= highlight_stylesheet_link_tag -%>
    and
    <%= highlight_javascript_include_tag -%>
  3. for the text you want to highlight call the highlight helper
    <%= highlight @post.body -%>
  4. IMPORTANT – at the bottom of the page put the following
    <%= highlight_initialize -%>

UPDATE: I refactored the plugin, especially the private make_options function and merged stylesheet and javascript helper into one called highlight_include_assets. The result is that the code is cleaner and the plugin is easier to use. Now step 2 in the usage paragraph is just one line of code and that is:

<%= highlight_include_assets -%>

UPDATE2: I’ve moved the code to google. So now you can get the latest version with:


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

Posted in Rails, 0 Comments Comments

Comments


COMMENTS ARE DISABLED