0

First off I'm pretty new to Jekyll (and posting on StackOverflow) but I've managed thus far. I had at one point gotten Jekyll to output highlighted code snippets within a fenced block code. Eventually I came back to work on things a while later and noticed the formatting went back to this, without the line numbers and <a> tags:

<code class="ruby language-ruby" data-lang="ruby">
    <span class="k">def</span> 
    <span class="nf">print_hi</span><span class="p">(</span><span class="nb">name</span><span class="p">)</span>
    <span class="nb">puts</span>
    <span class="s2">"Hi, </span><span class="si">#{</span><span class="nb">name</span><span class="si">}</span><span class="s2">"</span>
    <span class="k">end</span>
    <span class="n">print_hi</span>
    <span class="p">(</span><span class="s1">'Tom'</span><span class="p">)</span>
    <span class="c1">#=&gt; prints 'Hi, Tom' to STDOUT.</span>
</code>

Above code is derived from:

```ruby
def print_hi(name)
    puts "Hi, #{name}"
end
print_hi('Tom')
#=> prints 'Hi, Tom' to STDOUT.
```

My _config.yml:

name: Your New Jekyll Site
markdown: redcarpet
pygments: true
permalinks: pretty.

One key thing I noticed was that when I run rvm use system in the terminal, it serves jekyll with ruby 1.8.7 and let's me know in the terminak (which I assume would be a problem. Alternatively when I use ruby 2.0.0-p247, it just serves it but doesn't tell me which version it's being served with.

Pulling out my hair over this!

1 Answers1

2

Several more night hours and I've beaten the same problem (at least it looks like pretty similar one mentioned by you).

Anyway, for me it was because of newer version of Python set up than (accourdingly to this source) supported by 'Pygments' script, which is responsible of those blocks processing.

The newest version (for this moment) was 3.3. After playing and experimenting, reinstalling 2.7.5 version of Python back solved the issue.

I am a Windows user (I guess, that's not a big difference for Linux one in current situation) and used jekyll server locally.


Additionally... not sure which exactly approach you are using (I was trying also to install Jekyll on free Heroku hosting dyno as it's mentioned here), so was experiencing the same problem there (meaning, the same results), but after some explorations found out that those guys provide Python 2.7.4 using by default, and I had to specify the following thing explicitly in _config.yml Jekyll configuration file:

markdown: redcarpet
pygments: true

for Pygments thing to work.

(even thought they say that the latest version of Jekyll (as of 1.1) uses redcarpet by default... anyway, that might be related to some deep relationships between all the ruby/python/jekyll settings - I just let it go he he).

Agat
  • 4,577
  • 2
  • 34
  • 62