Created
October 6, 2012 13:27
-
-
Save houkanshan/3844941 to your computer and use it in GitHub Desktop.
gist in jekyll
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
# From https://github.com/mojombo/jekyll/issues/463 | |
# but run error on my jekyll. | |
# add a comments to stop jekyll auto omit the 'script' end-tag | |
# usage {% gist gist_id %} | |
module Jekyll | |
class GistTag < Liquid::Tag | |
def initialize(tag_name, text, tokens) | |
super | |
text = text.split(' ') | |
@text = text[0] | |
end | |
def render(context) | |
"<script src=\"http://gist.github.com/#{@text}.js\">//make jekyll happy</script>" | |
end | |
end | |
end | |
Liquid::Template.register_tag('gist', Jekyll::GistTag) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment