summaryrefslogtreecommitdiff
path: root/app/presenters/blob_presenter.rb
blob: 2bca413876c6d2cac7f4b567b92fa567b9a20d31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# frozen_string_literal: true

class BlobPresenter < Gitlab::View::Presenter::Simple
  presents :blob

  def highlight(plain: nil)
    Gitlab::Highlight.highlight(
      blob.path,
      blob.data,
      language: blob.language_from_gitattributes,
      plain: (plain || blob.no_highlighting?)
    )
  end
end