Skip to content

Commit ee402dd

Browse files
committed
Merge branch 'switch-to-pygmentsrb' of https://github.com/tombell/jekyll into tombell-switch-to-pygmentsrb
2 parents 88428a8 + 5865417 commit ee402dd

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Rakefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ task :default => [:test, :features]
5050

5151
require 'rake/testtask'
5252
Rake::TestTask.new(:test) do |test|
53-
if `which pygmentize` == ''
54-
puts "You must have Pygments installed to run the tests."
55-
exit 1
56-
end
5753
test.libs << 'lib' << 'test'
5854
test.pattern = 'test/**/test_*.rb'
5955
test.verbose = true
@@ -163,4 +159,4 @@ task :gemspec do
163159
spec = [head, manifest, tail].join(" # = MANIFEST =\n")
164160
File.open(gemspec_file, 'w') { |io| io.write(spec) }
165161
puts "Updated #{gemspec_file}"
166-
end
162+
end

jekyll.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
2727
s.add_runtime_dependency('directory_watcher', "~> 1.1")
2828
s.add_runtime_dependency('maruku', "~> 0.5")
2929
s.add_runtime_dependency('kramdown', "~> 0.13.4")
30-
s.add_runtime_dependency('albino', "~> 1.3")
30+
s.add_runtime_dependency('pygments.rb', "~> 0.2.12")
3131

3232
s.add_development_dependency('rake', "~> 0.9")
3333
s.add_development_dependency('rdoc', "~> 3.11")

lib/jekyll.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ def require_all(path)
2424
# 3rd party
2525
require 'liquid'
2626
require 'maruku'
27-
require 'albino'
27+
require 'pygments'
2828

2929
# internal requires
3030
require 'jekyll/core_ext'

lib/jekyll/tags/highlight.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,13 @@ def render(context)
4848
end
4949

5050
def render_pygments(context, code)
51-
output = add_code_tags(Albino.new(code, @lang).to_s(@options), @lang)
51+
@options[:encoding] = 'utf-8'
52+
53+
output = add_code_tags(
54+
Pygments.highlight(code, :lexer => @lang, :options => @options),
55+
@lang
56+
)
57+
5258
output = context["pygments_prefix"] + output if context["pygments_prefix"]
5359
output = output + context["pygments_suffix"] if context["pygments_suffix"]
5460
output

0 commit comments

Comments
 (0)