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

Passing options to Pygments #31

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

Comments

Projects
None yet
6 participants
@koraktor
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@qrush

qrush May 8, 2009

Contributor

Could you give an example of how this works?

Contributor

qrush commented May 8, 2009

Could you give an example of how this works?

@koraktor

This comment has been minimized.

Show comment
Hide comment
@koraktor

koraktor May 8, 2009

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@dcreager

dcreager Aug 14, 2009

+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.

+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

This comment has been minimized.

Show comment
Hide comment
@mojombo

mojombo Jan 14, 2010

Contributor

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

Contributor

mojombo commented Jan 14, 2010

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

@koraktor

This comment has been minimized.

Show comment
Hide comment
@koraktor

koraktor Feb 3, 2010

Contributor

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

Contributor

koraktor commented Feb 3, 2010

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

@mojombo

This comment has been minimized.

Show comment
Hide comment
@mojombo

mojombo Jun 22, 2010

Contributor

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

Contributor

mojombo commented Jun 22, 2010

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

@madhur

This comment has been minimized.

Show comment
Hide comment
@madhur

madhur Feb 29, 2012

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

madhur commented Feb 29, 2012

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

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

This issue was closed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.