Custom liquid tag for creating code blocks

This commit is contained in:
Chris Van Pelt 2008-11-23 14:55:15 -08:00
parent bcde0bd608
commit d8c54fa51a
1 changed files with 15 additions and 0 deletions

15
lib/jekyll/blocks.rb Normal file
View File

@ -0,0 +1,15 @@
module Jekyll
class Highlight < Liquid::Block
include Liquid::StandardFilters
def initialize(tag_name, lang, tokens)
super
@lang = lang.strip
end
def render(context)
"<pre class='syntax-highlight:#{@lang}'>#{escape(super)}</pre>"
end
end
end
Liquid::Template.register_tag('highlight', Jekyll::Highlight)