Skip to content

Instantly share code, notes, and snippets.

@razor-x
Last active January 27, 2016 06:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save razor-x/2f62cff9eaae2fcd8cee to your computer and use it in GitHub Desktop.
Save razor-x/2f62cff9eaae2fcd8cee to your computer and use it in GitHub Desktop.
Jekyll plugin for gist-async that modifies the gist markup added by its gist Liquid tag.
# Overrides the gist markup added by Jekyll's gist Liquid tag
# to support loading GitHub Gists asynchronously using gist-async from
# https://github.com/razor-x/gist-async
# Must load the jekyll-gist plugin:
# https://github.com/jekyll/jekyll-gist
require 'jekyll-gist'
module Jekyll
module Gist
class GistTag
def gist_script_tag(gist_id, filename = nil)
file_data_attr = filename.empty? ? '' : %Q{ data-gist-file="#{filename}"}
# Append additional markup to this string that will be replaced on gist load.
inner = ''
%Q{<div class="gist" data-gist="#{gist_id}"#{file_data_attr}>#{inner}</div>}
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment