Sha256: 4b2739a3cc2295ac506a6afaac7a126036a3579f47f370066141398088673045
Contents?: true
Size: 771 Bytes
Versions: 2
Compression:
Stored size: 771 Bytes
Contents
module Jekyll class Highlight < Liquid::Block include Liquid::StandardFilters def initialize(tag_name, lang, tokens) super @lang = lang.strip end def render(context) if Jekyll.pygments render_pygments(context, super.to_s) else render_codehighlighter(context, super.to_s) end end def render_pygments(context, code) "<notextile>" + Albino.new(code, @lang).to_s + "</notextile>" end def render_codehighlighter(context, code) #The div is required because RDiscount blows ass <<-HTML <div> <pre> <code class='#{@lang}'>#{h(code).strip}</code> </pre> </div> HTML end end end Liquid::Template.register_tag('highlight', Jekyll::Highlight)
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
mojombo-jekyll-0.1.5 | lib/jekyll/blocks.rb |
jekyll-0.1.5 | lib/jekyll/blocks.rb |