diff options
-rw-r--r-- | lib/gitlab/highlight.rb | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/gitlab/highlight.rb b/lib/gitlab/highlight.rb index fbed65a055b..57b7fc139f8 100644 --- a/lib/gitlab/highlight.rb +++ b/lib/gitlab/highlight.rb @@ -13,9 +13,10 @@ module Gitlab highlight(file_name, blob.data, repository: repository).lines.map!(&:html_safe) end - def initialize(blob_name, blob_content) + def initialize(blob_name, blob_content, repository: nil) @formatter = Rouge::Formatters::HTMLGitlab.new @repository = repository + @blob_name = blob_name @lexer = custom_language || begin Rouge::Lexer.guess(filename: blob_name, source: blob_content).new rescue Rouge::Lexer::AmbiguousGuess => e |