To write your own custom highlighter module, you just need to: # inherit from @Syntax::Convertors::Abstract@ # implement the @convert@ method You can use the @syntax/convertors/html.rb@ file as an example: {{{lang=ruby,number=true,caption=syntax/convertors/html.rb require 'syntax/convertors/abstract' module Syntax module Convertors # A simple class for converting a text into HTML. class HTML < Abstract # Converts the given text to HTML, using spans to represent token groups # of any type but :normal (which is always unhighlighted). If # +pre+ is +true+, the html is automatically wrapped in pre tags. def convert( text, pre=true ) html = "" html << "
" if pre
        regions = []
        @tokenizer.tokenize( text ) do |tok|
          value = html_escape(tok)
   case tok.instruction
            when :region_close then
              regions.pop
              html << ""
            when :region_open then
              regions.push tok.group
              html << "#{value}"
            else
         if tok.group == ( regions.last || :normal )
                html << value
 else
                html << "#{value}"
              end
          end
        end
        html << "" while regions.pop
        html << "
" if pre html end private # Replaces some characters with their corresponding HTML entities. def html_escape( string ) string.gsub( /&/, "&" ). gsub( //, ">" ). gsub( /"/, """ ) end end end end }}} Within the @#convert@ method, you will automatically have access to the @tokenizer@ instance variable--instantiated for you by the framework. The rest is up to you.