Skip to content

Instantly share code, notes, and snippets.

@kerotaa
Last active December 18, 2015 13:48
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 kerotaa/5792211 to your computer and use it in GitHub Desktop.
Save kerotaa/5792211 to your computer and use it in GitHub Desktop.
A plugin that converts code blocks to highlight tag in markdown.
module Jekyll
module Convertible
alias :origin_render_liquid :render_liquid
def render_liquid(content, payload, info)
content.gsub!(/(?:^|\n)```(\w*)\n(.*?\n)```\n/m) do |text|
$1.empty? ? text : "\n{% highlight #{$1} %}\n#{$2}{% endhighlight %}"
end
origin_render_liquid(content, payload, info)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment