pygments / pygments.rb

💎 Ruby wrapper for Pygments syntax highlighter
MIT License
572 stars 141 forks source link

Problem passing options to formatter #16

Closed tisba closed 12 years ago

tisba commented 12 years ago

I'm currently working on a feature for an octopress plugin (https://github.com/imathis/octopress/pull/478). I need to pass the linenostart option to the formatter.

Calling Pygments with Pygments.highlight(code, :lexer => lang, :formatter => 'html', :options => {:encoding => 'utf-8', :linenostart => 2}) has no effect. Unfortunately I'm not very good at reading and understanding python code, but the option gets properly passed to Pygments::FFI.formatter_for

Any idea what's going on?

mislav commented 12 years ago

You have to enable linenos too:

options: {linenostart: 2, linenos: 'inline'}
tisba commented 12 years ago

Got it. Octopress' wrapper for pygments.rb renders the line numbers by itself. Sorry for the noise.