Skip to content

Passing options to Pygments #31

Closed
koraktor opened this Issue May 4, 2009 · 7 comments

5 participants

@koraktor
koraktor commented May 4, 2009

Right now only linenos can be passed to Pygments. I built a small patch for the highlight tag allowing general passing of options to Pygments. This can be used e.g. for startinline for PHP code.

http://github.com/koraktor/jekyll/commit/dd12900dd59b2a6526040fc7d1400f35a8a73fe8

@qrush
qrush commented May 8, 2009

Could you give an example of how this works?

@koraktor
koraktor commented May 8, 2009

For example using startinline will cause PHP code to get highlighted without the need for <?php ?>.

<% highlight php linenos startinline %>
$inline = true;
echo "This is inline PHP code.";
<% endhighlight %>

will result in highlighted PHP code and line numbers.

There are several other options, most of them are boolean. So the value defaults to true if an option is set. But you can also use e.g. encoding=utf-8 or tabsize=2.

@dcreager

+1

Solid! I was about to start a patch that would let me set linenostart in my highlighted code, but this looks like it would do exactly what I need.

@mojombo
mojombo commented Jan 14, 2010

This patch looks good. As a feature addition it will go into 1.1.

@koraktor
koraktor commented Feb 3, 2010

The changes now reside in koraktor/jekyll@pygments-options.

@mojombo
mojombo commented Jun 22, 2010

Changed my mind. This is merged in master and going in the next release.

@mgriffin mgriffin pushed a commit that referenced this issue Sep 8, 2011
@mojombo mojombo update history for #31 6932a40
@madhur
madhur commented Feb 29, 2012

Has this been included in latest Jekyll release ? I am wondering because the issue status stays "Pending"

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.