diff options
Diffstat (limited to 'app/presenters/blob_presenter.rb')
-rw-r--r-- | app/presenters/blob_presenter.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/app/presenters/blob_presenter.rb b/app/presenters/blob_presenter.rb new file mode 100644 index 00000000000..2bca413876c --- /dev/null +++ b/app/presenters/blob_presenter.rb @@ -0,0 +1,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 |