Added escape for liquid tags {{ and {% so that Liquid doesn't barf when a language uses these characters. Closes #466

This commit is contained in:
Brandon Mathis 2012-06-11 01:08:05 -05:00
parent bfb348695f
commit f3978d1604

View File

@ -39,9 +39,11 @@ module HighlightCode
linenos = options[:linenos]
start = options[:start]
code = code.gsub(/{{/, '{{').gsub(/{%/, '{%')
if lang == 'plain'
# Escape html tags
code = code.gsub('<','&lt;').gsub('>','&gt;')
code = code.gsub('<','&lt;')
elsif lang.include? "-raw"
output = "``` #{$1.sub('-raw', '')}\n"
output += code