Sha256: 1281a101068d01d9a20a41c9daccc7febc4c10735d5cb43df498bd46f54512b0
Contents?: true
Size: 905 Bytes
Versions: 1
Compression:
Stored size: 905 Bytes
Contents
module Jekyll class HighlightBlock < 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) if Jekyll.content_type == :markdown return "\n" + Albino.new(code, @lang).to_s + "\n" else "<notextile>" + Albino.new(code, @lang).to_s + "</notextile>" end 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::HighlightBlock)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
codeslinger-jekyll-0.3.0 | lib/jekyll/tags/highlight.rb |