diff --git a/lib/gitlab/markdown/emoji_filter.rb b/lib/gitlab/markdown/emoji_filter.rb index e239f766844..6794ab9c897 100644 --- a/lib/gitlab/markdown/emoji_filter.rb +++ b/lib/gitlab/markdown/emoji_filter.rb @@ -15,7 +15,7 @@ module Gitlab IGNORED_ANCESTOR_TAGS = %w(pre code tt).to_set def call - doc.search('text()').each do |node| + search_text_nodes(doc).each do |node| content = node.to_html next unless content.include?(':') next if has_ancestor?(node, IGNORED_ANCESTOR_TAGS) diff --git a/lib/gitlab/markdown/reference_filter.rb b/lib/gitlab/markdown/reference_filter.rb index 26663c8d990..ef4aa408a7e 100644 --- a/lib/gitlab/markdown/reference_filter.rb +++ b/lib/gitlab/markdown/reference_filter.rb @@ -49,7 +49,7 @@ module Gitlab def replace_text_nodes_matching(pattern) return doc if project.nil? - doc.search('text()').each do |node| + search_text_nodes(doc).each do |node| content = node.to_html next unless content.match(pattern)