summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorDouwe Maan <douwe@gitlab.com>2018-10-30 20:44:03 +0000
committerDouwe Maan <douwe@gitlab.com>2018-10-30 20:44:03 +0000
commit571e651b21c7a618b8686a4b3f8a8c09c87a37f5 (patch)
tree168c177b68440043ffa08ce282b894cab5728148 /app/helpers
parent7bcd0dc19bfd31e79d52ae148d3edf15b054cb5a (diff)
parent0fa5260f1d1e99bcd0429cba09140c039a3d9d5a (diff)
downloadgitlab-ce-571e651b21c7a618b8686a4b3f8a8c09c87a37f5.tar.gz
Merge branch 'add-language-param-to-highlight' into 'master'
Add language param to highlight See merge request gitlab-org/gitlab-ce!21584
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/blob_helper.rb5
1 files changed, 2 insertions, 3 deletions
diff --git a/app/helpers/blob_helper.rb b/app/helpers/blob_helper.rb
index ff7f1e3a9aa..638744a1426 100644
--- a/app/helpers/blob_helper.rb
+++ b/app/helpers/blob_helper.rb
@@ -1,9 +1,8 @@
# frozen_string_literal: true
module BlobHelper
- def highlight(blob_name, blob_content, repository: nil, plain: false)
- plain ||= blob_content.length > Blob::MAXIMUM_TEXT_HIGHLIGHT_SIZE
- highlighted = Gitlab::Highlight.highlight(blob_name, blob_content, plain: plain, repository: repository)
+ def highlight(file_name, file_content, language: nil, plain: false)
+ highlighted = Gitlab::Highlight.highlight(file_name, file_content, plain: plain, language: language)
raw %(<pre class="code highlight"><code>#{highlighted}</code></pre>)
end