Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Syntax Highlighting with Pygments is failing via Liquid Templates String Error

I'm using Jekyll to convert my markdown and Pygments for syntax highlighting.

Here is the error maruku displays:

Liquid error: undefined method `join' for "\n song_info = []\n for song in songs:\n song_info.append(song.name) \n":String

The markup is as follows:

{% highlight python %}
    song_info = []
    for song in songs:
        song_info.append(song.name)                                                                                                                                   
{% endhighlight %}

Testing Pygments in iPython produces no errors.

Any ideas? ;o(

Thanks in advance!

like image 514
muffs Avatar asked Oct 18 '11 00:10

muffs


3 Answers

I had the same problem and reverted the liquid gem to version 2.2.2 as a workaround. Seems like a bug in the 2.3.0 version's pygments support, or Jekyll's use of it.

sudo gem uninstall liquid
sudo gem install liquid --version '2.2.2'
like image 58
olov Avatar answered Sep 29 '22 11:09

olov


On a side note, GitHub recommends using RedCarpet.

To use it, configure Jekyll by adding markdown: redcarpet to ./_config.yml. Then, install RedCarpet with [sudo] gem install redcarpet on your development machine so you can compile your Jekyll site.

like image 35
ma11hew28 Avatar answered Sep 29 '22 10:09

ma11hew28


Simply replace liquid-2.3.0 gem files with latest version from Github.

It works with jekyll-0.11.2 + liquid-2.3.0 + Pygments

like image 20
Jarod Denison Avatar answered Sep 29 '22 11:09

Jarod Denison