commit
1c53c28c79
2 changed files with 7 additions and 1 deletions
|
@ -21,7 +21,7 @@ module GitlabMarkdownHelper
|
||||||
|
|
||||||
gfm_body = Gitlab::Markdown.gfm(escaped_body, project: @project, current_user: current_user)
|
gfm_body = Gitlab::Markdown.gfm(escaped_body, project: @project, current_user: current_user)
|
||||||
|
|
||||||
fragment = Nokogiri::XML::DocumentFragment.parse(gfm_body)
|
fragment = Nokogiri::HTML::DocumentFragment.parse(gfm_body)
|
||||||
if fragment.children.size == 1 && fragment.children[0].name == 'a'
|
if fragment.children.size == 1 && fragment.children[0].name == 'a'
|
||||||
# Fragment has only one node, and it's a link generated by `gfm`.
|
# Fragment has only one node, and it's a link generated by `gfm`.
|
||||||
# Replace it with our requested link.
|
# Replace it with our requested link.
|
||||||
|
|
|
@ -106,6 +106,12 @@ describe GitlabMarkdownHelper do
|
||||||
act = link_to_gfm(text, '/foo')
|
act = link_to_gfm(text, '/foo')
|
||||||
expect(act).to eq %Q(<a href="/foo">#{issues[0].to_reference}</a>)
|
expect(act).to eq %Q(<a href="/foo">#{issues[0].to_reference}</a>)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should replace commit message with emoji to link' do
|
||||||
|
actual = link_to_gfm(':book:Book', '/foo')
|
||||||
|
expect(actual).
|
||||||
|
to eq %Q(<img class="emoji" title=":book:" alt=":book:" src="http://localhost/assets/emoji/1F4D6.png" height="20" width="20" align="absmiddle"><a href="/foo">Book</a>)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#render_wiki_content' do
|
describe '#render_wiki_content' do
|
||||||
|
|
Loading…
Reference in a new issue