dont escape images inside links for gfm. Fixes #2701
This commit is contained in:
parent
1c931fb814
commit
f72dc7f779
1 changed files with 7 additions and 1 deletions
|
@ -13,7 +13,13 @@ module GitlabMarkdownHelper
|
||||||
def link_to_gfm(body, url, html_options = {})
|
def link_to_gfm(body, url, html_options = {})
|
||||||
return "" if body.blank?
|
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|
|
gfm_body.gsub!(%r{<a.*?>.*?</a>}m) do |match|
|
||||||
"</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1
|
"</a>#{match}#{link_to("", url, html_options)[0..-5]}" # "</a>".length +1
|
||||||
|
|
Loading…
Reference in a new issue