Search code examples
jekylljekyll-extensions

Why is using the highlight tag for syntax highlighting mking code disappear?


I am using Jekyll with pigments to highlight some code in my blog and any code in the highlights tag seems to disappear, i.e. no Html generated.

Here is an example of some such code

{% highlight java %}
ObjectMapper mapper = new ObjectMapper();
mapper.getSerializationConfig().
setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
{% endhighlight %}

Some other details;

  • OS: OSX Mountain Lion Ruby version:
  • ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin12.1.0]
  • Jekyll version: Jekyll 0.11.2

While googling someone suggested running this command to check pygments

echo 'puts "Hello World"' | pygmentize -l ruby -f html -O encoding=utf-8 

For me it returns this error:

Traceback (most recent call last):
  File "/usr/local/bin/pygmentize", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
    working_set.require(__requires__)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
    raise DistributionNotFound(req)  # XXX put more info here
pkg_resources.DistributionNotFound: Pygments==1.5

Solution

  • I think your easy_install eggs were being put in: ~/Library/Python/2.7/site-packages/ while they are needed to be in: /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/

    Just copy the files (eggs and easy_install.path's contents) over and it should solve your problem.