Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add additional (optional) syntax highlight renderer: pygments.rb #41

Closed
wants to merge 1 commit into from
Closed

Add additional (optional) syntax highlight renderer: pygments.rb #41

wants to merge 1 commit into from

Conversation

kassi
Copy link

@kassi kassi commented Jul 24, 2013

My editor cleans up whitespace automatically. That's why there are some related changes.

@Bodacious
Copy link
Owner

A quick benchmark of Pygments VS Albino shows that Pygments is a much better option:

According to their README, even Github have deprecated albino in favour of pygments

require 'benchmark'
require 'pygments'
require 'albino'

TIMES = 10
data = DATA.read.dup

Benchmark.bmbm do |test|

  test.report("With Pygments") do
    TIMES.times { Pygments.highlight(data) }  
  end

  test.report("With Albino") do
    TIMES.times { Albino.colorize(data, :ruby) }  
  end

end

__END__
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

``` ruby
def code
  puts "This is some code"
end
```

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

``` ruby
def code
  puts "This is some code"
end
```

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

``` ruby
def code
  puts "This is some code"
end
```

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.  

@Bodacious
Copy link
Owner

@kassi Thanks for the pull request, but I'm going to update the gem to use pygments instead of albino

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants