Sha256: e9cc67fac557810f4ffaea3780872324d2891c9b56275ea33192363bf7b70e6f
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 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) "<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::HighlightBlock)
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
tristandunn-jekyll-0.3.0 | lib/jekyll/tags/highlight.rb |