Jekyll on Windows: Pygments Not Working

Jekyll on Windows: Pygments not working

I had the same issue. Seems there's a problem in Pygments.rb 0.5.1. By rolling back to Pygments 0.5.0 the error disappeared.

gem uninstall pygments.rb --version ">0.5.0"
gem install pygments.rb --version "=0.5.0"

Hope this helps.

Jekyll install on Windows error message

This was an issue that was addressed by me by another question a few days ago.This is the original question and my answer.

Basically the issue here is that you need to install Python to use Jekyll on Windows because the code highlighter Pygments is written in Python, hence requires Python to function. Pygments is alsothe default code highlighter currently. In the future versions of Jekyll will use the Rouge highlighter, which is written completely in Ruby. This issue is tracked on GitHub.

To solve your current problem, you just need to install Python 2.x, which the official linked guide from the Jekyll documentation provides very clear instructions there. You will also need to install pip. I have also included alternatives in the other SO answer I have given, so I will just provide you the link to it to reduce duplicate information and copy-paste.

Once you have Python 2.x and pip set up, and install pygments, your Jekyll install should be up and running with the site template!

Regarding the Gemfile

A summary of what a Gemfile is: A file that lists all the required Ruby gems for a particular program. For example, you wrote a ruby program that depends on 10 other gems, rather than ask the user of your new gem to go download the previous 10 gems, and then later wrestle with outdated gem issues, a Gemfile is used to keep track of what gems are needed and version. The Gemfile is used by Bundler, which is also a gem that automatically keeps track of what gems you need. In the case of Jekyll, you can use a Gemfile to dictate what you want added into your Jekyll install or removed. This is used by GitHub to keep local versions of Jekyll and other gems updated with the version used by Github Pages.

As for that notification, all you would need to do to avoid polling for changes is:

  1. Open notepad or text editor of choice.

  2. Add this line: gem 'wdm','>=0.1.0' if Gem.win_platform, just that line of text. You can later add gems by typing in gem 'nameOfGem in a separate line.

  3. Save the file as Gemfile in your Jekyll site's folder. Notice that there is not .txt extension, which you can create a file with no extension in notepad by choosing 'All Files' instead of '.txt' under 'Save As'. Or, you could just edit the file extension to remove the .txt.

  4. Install bundler by executing gem install bundler.

  5. Run bundle install to update the gems. If you're using GitHub, add the Gemfile and the newly generated Gemfile.lock into git.

Jekyll serve didn't work: It looks like you don't have pygments or one of its dependencies installed

I had the same issue but fixed it installing pygments gem.

gem install pygments.rb

And adding it to my Gemfile.

gem 'pygments.rb'

Jekyll on Windows Liquid Exception: Failed to get header

I also got this error, and a couple of other similar errors too, and finally got to a solution: you need to have a couple of compatible versions of the required Ruby, Python and Pygments.

  • Install Ruby 1.9.3-p448 version (download here);
  • Install Python 2.7.5 version (download here);
  • Install Pygments 0.5.0

    gem uninstall pygments.rb
    gem install pygments.rb --version "=0.5.0"

I hope it helps.

Edited: Don't forget to add the correct PATHs to your system variables. In my case, it was:

C:\Python27;C:\Ruby193


In order to improve this content, there is a simple tutorial (written in Portuguese, but I guess you can understand the steps, always considering the versions of software/plugins listed above) - view tutorial.

Error when run jekyll server on windows 7

Python does not appear to be installed, which is why you get a liquid exception when trying to use the code highlighter Pygments.

According to this tutorial, which is the suggested tutorial written by Julian Thilo on the Jekyll documentation, you need Python 2.7.x at time of writing. Here is a summary of what you need to do to get the Jekyll install and server up and running.

Step 1 : Get Python

Download the latest version of Python 2.7: here

Note: Make sure to add python.exe to Path and select “Entire feature will be installed on local hard drive. This is needed on Windows or else Jekyll will fail to build the website when trying to highlight code with Pygments.

Step 2: Install Pip

It's a Python package manager which you'll use to install Pygments. follow the official documentation for doing this.

Step 3: Get Pygments

Finally, Open up a command line and type in python -m pip install Pygments

Step 4 : Done

Run jekyll serve again.

Optional Step

Since Pygments is the default syntax highlighter, you don't have to explicitly define what highlighter you're using, but if you prefer to, add this line to your _config.yml file: highlighter : pygments

ALTERNATIVE 1: Don't want highlighters

If you won't be using a code highlighter just edit the markdown post you have 2015-06-02-welcome-to-jekyll.markdown and remove the Liquid tags like so:

{% highlight ruby %}

  //Ruby code on the template you can ignore

{% endhighlight %}

ALTERNATIVE 2: Rouge, no need for Python

Rouge is a Ruby code highlighter, which while does not require Python and all that dependencies as it is written completely in Ruby (which you already have because Jekyll runs on Ruby). You'll need to edit the _config.yml to use rouge like so: highlighter : rouge, and run gem install rouge in the command line, as mentioned in same tutorial. Note that at time of writing Rouge has lesser language support compared to Pygments. (but still a whole lot)

Here's another tutorial on setting up Jekyll on Windows. And it would be a good idea to follow the excellent tutorial I've previously linked for installing Jekyll on Windows.

Jekyll Bootstrap with Rouge Highlighting not working on Windows

All right.
Turns out I was doing everything well...
However I was also using MetroUI Styling with default metro.js file included to website.
Turns out that default metroui script was breaking the formatting...



Related Topics



Leave a reply



Submit