Friday, April 29, 2011

Highlighting my code with some rays of Sunlight.

This is the best syntax highlighting system I've found for the web, and I've tried a couple; and it's also context-aware.

It's what I am currently using for this blog. Tommy Montgomery, I salute you.

Here's an example:

/**
 * jQuery plugin for Sunlight http://sunlightjs.com/
 *
 * (c) 2011 Tommy Montgomery http://tommymontgomery.com/
 * licensed under WTFPL http://sam.zoy.org/wtfpl/
 */
(function($, window, undefined){
 
 $.fn.sunlight = function(options) {
  var highlighter = new window.Sunlight.Highlighter(options);
  this.each(function() {
   highlighter.highlightNode(this);
  });
  
  return this;
 };
 
}(jQuery, window));

Huh, it's highlighting itself.

No comments:

Post a Comment