Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

I want syntax highlighting

#16

Maybe we could have a 'code' renderer, using the Syntax gem or something, that renders snips with syntax highlighting.

The language the snip is written in could be an attribute of the snip?

Reported by James Adam · June 5th, 2008 @ 10:03 PM

State: resolved
Milestone: 0.6
Assigned to: James Adam James Adam

Activity

  1. James Adam
    James Adam
    • Tag set to code, renderer, ruby, syntax
    • Milestone set to 0.6

    July 2nd, 2008 @ 09:40 PM

  2. James Adam
    James Adam
    • State changed from new to resolved

    Kindof works now, thanks to a hackety dyna:

    require 'syntax/convertors/html'
    class CodeHighlighter < Dynasnip
      def handle(language, snip_to_render, part_to_render='content')
        snip = Vanilla.snip(snip_to_render)
        text = snip.__send__(part_to_render.to_sym)
        convertor = Syntax::Convertors::HTML.for_syntax(language)
        code = convertor.convert(text, false)
        %(<pre class="code ) + language + %("><code>) + code + %(</code></pre>)
      end
    
      self
    end
    

    July 17th, 2008 @ 05:48 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.