lib/gitlab/markdown/snippet_reference_filter.rb
# Replace `$123` snippet references in text with links to the referenced
# snippets'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-snippet` class names attached for styling.
Replace `$123` snippet references in text with links to the referenced
snippets's details page.

String text to replace references in.

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