Last active
December 20, 2015 07:29
-
-
Save curiouslychase/6093506 to your computer and use it in GitHub Desktop.
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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