lib/gitlab/markdown/merge_request_reference_filter.rb
# Replace `!123` merge request references in text with links to the
# referenced merge request's details page.
#
# text - String text to replace references in.
#
# Returns a String with `!123` references replaced with links. All links
# have `gfm` and `gfm-merge_request` class names attached for styling.
Replace `!123` merge request references in text with links to the
referenced merge request's details page.

String text to replace references in.

Returns a String with `!123` references replaced with links. All links
have `gfm` and `gfm-merge_request` class names attached for styling.
Replace ` !123 ` merge request references in text with links to the referenced merge request ' s details page . String text to replace references in . Returns a String with ` !123 ` references replaced with links . All links have ` gfm ` and ` gfm - merge_request ` class names attached for styling .
def merge_request_link_filter(text)
        self.class.references_in(text) do |match, id, project_ref|
          project = self.project_from_ref(project_ref)
          if project && merge_request = project.merge_requests.find_by(iid: id)
            push_result(:merge_request, merge_request)
            title = escape_once("Merge Request: #{merge_request.title}")
            klass = reference_class(:merge_request)
            url = url_for_merge_request(merge_request, project)
            %(<a href="#{url}"
                 title="#{title}"
                 class="#{klass}">#{match}</a>)
          else
            match
          end
        end
      end
def merge_request_link_filter ( text ) self . class . references_in ( text ) do | match , id , project_ref | project = self . project_from_ref ( project_ref ) if project && merge_request = project . merge_requests . find_by ( iid : id ) push_result ( :merge_request , merge_request ) title = escape_once ( "Merge Request: #{merge_request.title}" ) klass = reference_class ( :merge_request ) url = url_for_merge_request ( merge_request , project ) %(<a href="#{url}"
                 title="#{title}"
                 class="#{klass}">#{match}</a>) else match end end end
Replace `!123` merge request references in text with links to the
referenced merge request's details page.
Replace ` !123 ` merge request references in text with links to the referenced merge request ' s details page .
text
<not_specific>