Specify language detection for highlight.js

Because I am tired of CHANGELOG highlighted as sql file :)

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
This commit is contained in:
Dmitriy Zaporozhets 2014-06-07 15:46:58 +03:00
parent ab094e67ee
commit 0d13abb1c8
No known key found for this signature in database
GPG Key ID: 627C5F589F467F17
2 changed files with 19 additions and 1 deletions

View File

@ -0,0 +1,18 @@
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

View File

@ -8,5 +8,5 @@
= i
.highlight
%pre
%code
%code{ class: highlightjs_class(blob.name) }
= blob.data