Last active
December 18, 2015 13:48
-
-
Save kerotaa/5792211 to your computer and use it in GitHub Desktop.
A plugin that converts code blocks to highlight tag in markdown.
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
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