Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A script to modify Jekyll's highlight class. Updated for Jekyll 1.0.3 from this blog post: http://thanpol.as/jekyll/jekyll-code-highlight-and-line-numbers-problem-solved/
# Working as of Jekyll 1.0.3
module Jekyll
class WrapHighlightBlock < Jekyll::Tags::HighlightBlock
def initialize(tag_name, markup, tokens)
super
end
def render(context)
'<figure class="code"><figcaption></figcaption>' + super + '</figure>'
# I use gist for big code blocks, so I wanted to make my jekyll highlighting
# reflect the same node tree for keeping styles dry
# '<div class="gist-file"><div class="gist-data gist-syntax"><div class="line">' + super + '</div></div></div>'
end
end
end
Liquid::Template.register_tag('highlight', Jekyll::WrapHighlightBlock)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.