Daikini

We're human after all.

SimpleHighlight Plugin Updated

Posted by Jonathan on August 26, 2007 at 08:47 PM

Due to the awesome work of S. Brent Faulkner the SimpleHighlight plugin now supports theme selection and turning on/off line numbering on a per code block basis. Thanks Brent!

   1  <code theme="mac_classic" numbers="no">
   2  class Post
   3    has_many :comments
   4  end
   5  </code >
class Post
  has_many :comments
end

SimpleHighlight - Syntax highlighting for SimpleLog

Posted by Jonathan on June 14, 2007 at 10:02 AM

SimpleHighlight uses the ultraviolet library for syntax highlighting of code inside posts. You must have ultraviolet installed and working for SimpleHighlight to work.

Installation

To install SimpleHighlight you can:

./script/plugin install svn://svn.roundhaus.com/daikini/plugins/simple_highlight

or if you prefer piston:

piston import svn://svn.roundhaus.com/daikini/plugins/simple_highlight vendor/plugins/simple_highlight

You will also need to include the css for the particular theme you are using. The css files are included as part of the ultraviolet library.

Usage

To use SimpleHighlight you just add code tags around whatever code you want to have highlighted. You can optionally specify the language to use with by adding a class on to the code tag with the language you want. By default code uses the ruby_on_rails language. SimpleHighlight also defaults to using the “all_hallows_eve” theme. Right now the only way to change the theme is to change it in the plugin code itself.

Here is some RubyOnRails code:

   1  class Post
   2    has_many :comments
   3  end

Here is some Javascript code:

   1  function init()
   2  // init vars, run some initial functions
   3  {
   4      body_container = document.getElementById('wrapper');
   5      search_field = document.getElementById('q');
   6      search_div = document.getElementById('search');
   7      results_wrapper_div = document.getElementById('search_results');
   8      loading_msg_span = document.getElementById('loading');
   9      results_span = document.getElementById('results');
  10      tag_block = document.getElementById('tags');
  11      author_block = document.getElementById('authors');
  12  
  13      default_field_value = 'Enter your terms, hit enter';
  14      message_when_searching = 'Searching...';
  15      message_when_done = '';
  16      results_when_searching = '';
  17  
  18      passive_search_text_color = '#777';
  19      active_search_text_color = '#000';
  20  
  21      isIE = false;
  22  
  23      searchInit(search_field); // capture key events
  24      clearSearch(); // set everything right with search field / areas
  25  }

Here is some CSS code:

   1  /**
   2   * =Body
   3   ***************************/
   4  body {
   5      font: normal 14px/22px Helvetica, Arial, Helvetica, Sans-serif;
   6      margin: 0;
   7      padding: 0;
   8      color: #4c4c4c;
   9      background-color: #273d4a;
  10      text-align: center;
  11  }