From 739f7525802f343ae673f9b921b641c5bb5acf5b Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Wed, 8 May 2013 00:45:55 +0200 Subject: [PATCH] Properly wrap and encode non-pygmentized code. --- lib/jekyll/converters/markdown/redcarpet_parser.rb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/jekyll/converters/markdown/redcarpet_parser.rb b/lib/jekyll/converters/markdown/redcarpet_parser.rb index 4d74f326..ceecd85e 100644 --- a/lib/jekyll/converters/markdown/redcarpet_parser.rb +++ b/lib/jekyll/converters/markdown/redcarpet_parser.rb @@ -23,10 +23,17 @@ module Jekyll end module WithoutPygments + require 'cgi' + include CommonMethods + + def code_wrap(code) + "
#{CGI::escapeHTML(code)}
" + end + def block_code(code, lang) lang = lang && lang.split.first || "text" - output = add_code_tags(code, lang) + output = add_code_tags(code_wrap(code), lang) end end