Custom liquid tag for creating code blocks
This commit is contained in:
parent
bcde0bd608
commit
d8c54fa51a
|
@ -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)
|
Loading…
Reference in New Issue