From 7924e8c9a90a772d90da5f7c6a3366bfc5010fbb Mon Sep 17 00:00:00 2001 From: xdite Date: Thu, 1 Dec 2011 19:26:14 +0800 Subject: [PATCH] compatible with RedCarpet 2.0+ --- lib/gollum/markup.rb | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/lib/gollum/markup.rb b/lib/gollum/markup.rb index ba1d1969..ec28d604 100644 --- a/lib/gollum/markup.rb +++ b/lib/gollum/markup.rb @@ -447,15 +447,28 @@ module Gollum data = extract_code(data) data = extract_tags(data) - flags = [ - :autolink, - :fenced_code, - :tables, - :strikethrough, - :lax_htmlblock, - :no_intraemphasis - ] - data = Redcarpet.new(data, *flags).to_html + if Gem::Version.new(Redcarpet::VERSION) > Gem::Version.new("1.17.2") + html_renderer = Redcarpet::Render::HTML.new({ + :autolink => true, + :fenced_code_blocks => true, + :tables => true, + :strikethrough => true, + :lax_htmlblock => true, + :no_intraemphasis => true + }) + markdown = Redcarpet::Markdown.new(html_renderer) + data = markdown.render(data) + else + flags = [ + :autolink, + :fenced_code, + :tables, + :strikethrough, + :lax_htmlblock, + :no_intraemphasis + ] + data = Redcarpet.new(data, *flags).to_html + end data = process_tags(data) data = process_code(data)