Santize @config['highlighter'] to only allow highlighters supported by kramdown

This commit is contained in:
Paul Robert Lloyd 2015-11-01 23:04:59 +00:00
parent 9d1641f163
commit e5279d4773
1 changed files with 5 additions and 1 deletions

View File

@ -5,7 +5,11 @@ module Jekyll
def initialize(config)
require 'kramdown'
@config = config
@config['kramdown']['syntax_highlighter'] ||= @config['highlighter']
# If kramdown supported highlighter enabled, use that
highlighter = @config['highlighter']
if highlighter == 'rouge' || highlighter == 'coderay'
@config['kramdown']['syntax_highlighter'] ||= highlighter
end
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install kramdown'