Skip to content

Instantly share code, notes, and snippets.

@kerotaa
Last active December 18, 2015 13:48
Show Gist options
  • 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