summaryrefslogtreecommitdiff
path: root/lib/markdown_utils.rb
blob: f33d80da14c5f9b8404c960c299e282119d115a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
# Class to have all utility functions related to markdown
class MarkdownUtils
  # Convert image urls in the markdown text to absolute urls
  def self.absolute_image_urls(markdown_text)
    if markdown_text.present?
      markdown_text.gsub(/!\[(.*?)\]\((.*?)\)/, "![\\1](#{Settings.gitlab.url}\\2)")
    else
      markdown_text
    end
  end
end