Commit 0d13abb1 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Specify language detection for highlight.js

Because I am tired of CHANGELOG highlighted as sql file :)
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ab094e67
module BlobHelper
def highlightjs_class(blob_name)
if blob_name.include?('.')
ext = blob_name.split('.').last
return 'language-' + ext
else
if no_highlight_files.include?(blob_name.downcase)
'no-highlight'
else
blob_name.downcase
end
end
end
def no_highlight_files
%w(credits changelog copying copyright license authors)
end
end
...@@ -8,5 +8,5 @@ ...@@ -8,5 +8,5 @@
= i = i
.highlight .highlight
%pre %pre
%code %code{ class: highlightjs_class(blob.name) }
= blob.data = blob.data
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment