Syntax Highlighting with Pygments is failing via Liquid Templates String Error #422

yihui opened this Issue Oct 22, 2011 · 13 comments


None yet

I can at least confirm that the problem only appears with Liquid v2.3.0, after reverting to v2.2.2 everything worked fine.

tatey commented Oct 30, 2011

Great, thanks for the tip.

@scotu scotu added a commit to scotu/jekyll that referenced this issue Nov 6, 2011
@scotu scotu Workaround that should fix #422 83c34a3
knarf-se commented Nov 7, 2011

I Can also confirm the issue; But for some reason it does not work to revert Liquid to v2.2.2 in my case -- it just eats the things I pass to Liquid (or at least the {% highlight lang %}-thingie)...

So I tried to tell jekyll that I wanted it to use redcarpet instead, it told me to install the gem and so I did. I does not complain about that I does not have redcarpet any more, but it does not seem like it is actually using redcarpet at all!?

By now, I've even forgot what I was going to write about :-/

I guess that I should open my own Issue-thingie, but actually - I do not care anymore.

scotu commented Nov 7, 2011

@knarf-se can you double check if you have pygments installed? (on ubuntu sudo apt-get install python-pygments)

knarf-se commented Nov 7, 2011

I already had gotten pygments from (So that some program could find it, don't remember how I installed it) -- now code highlighting works via Liquid, but it still seems like Jekyll can't use RedCarpet, so I guess that I'll make an preprocessor that turns ''' lang ... ''' into {% highlight lang %} ... {% endhighlight %} (with ''' being triplebackticks, it's easier to remember that syntax).

kylev commented Nov 9, 2011

The problem is that liquid now returns a string instead of an array:

The correct solution (I believe) is to remove the two join calls inside Jekyll::HightlightBlock#render . However, you may need to add explicit to_s for it to work in both Ruby 1.8 and 1.9 and across multiple Liquid versions. Or perhaps use respond_to?(:join) .

Caged commented Nov 17, 2011

If you're looking for a quick fix: gem uninstall liquid and gem install liquid -v 2.2.2


@Caged's solution works for me, it is indeed a Liquid 2.3.0 issue.

tobi commented Nov 26, 2011

I think this should probably be fixed in the highlight helper as it was relying on private implementation detail of the liquid render stack previously.

Liquid 2.3 has features that jekyll could really use ( performance, {% raw %} ) so that would be the better way.


Hey mate!
Just replaced liquid-2.3.0 gem files with latest version from Github (
It works with jekyll-0.11.2 + liquid-2.3.0 + Pygments

dreambt commented Oct 20, 2012


parkr commented Mar 19, 2013

@mojombo fixed this in 1da88bb

@parkr parkr closed this Mar 19, 2013
@jekyllbot jekyllbot locked and limited conversation to collaborators Feb 27, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.