dont escape images inside links for gfm. Fixes #2701

This commit is contained in:
Dmitriy Zaporozhets 2013-01-29 11:00:56 +02:00
parent 1c931fb814
commit f72dc7f779
1 changed files with 7 additions and 1 deletions

View File

@ -13,7 +13,13 @@ module GitlabMarkdownHelper
def link_to_gfm(body, url, html_options = {})
return "" if body.blank?
gfm_body = gfm(escape_once(body), html_options)
escaped_body = if body =~ /^\<img/
body
else
escape_once(body)
end
gfm_body = gfm(escaped_body, html_options)
gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match|
"</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1