Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make syntax highlighting work in octopress

This is really getting frustrating. I don't know what's wrong with my markdown files as it compiled to html before without any problems but now its giving me this error whenever I run rake generate. Now I mainly use trial and error for every file(30 markdown files) and I test them out one by one if it compiles when I run rake generate

enter image description here

I'm fine with running the same command a hundred times but if I have no idea what is wrong then how can I debug it.

Here are the files that I found to be causing the error:

https://gist.github.com/4307839

https://gist.github.com/4307833

Update

Ok it turns out that this isn't a problem with the syntax, its about the syntax highlighting. When I do something like:

{% codeblock lang:JavaScript %}
console.log(25 + "yoyos"); 
//output: "25yoyos" 
{% endcodeblock %}

It doesn't work. But when I remove the language option:

{% codeblock %}
console.log(25 + "yoyos"); 
//output: "25yoyos" 
{% endcodeblock %}

It works.

I'm getting this error whenever I view the page using rake preview.

Liquid error: No such file or directory - -c “import sys; print ‘%d.%d’ % sys.version_info[:2]”

I already did some research and tried every possible solution on the issues on github.

  • bundle update
  • edit rubypython

if (@python.include? 'python2.7') @python = "python27" end

I've installed ruby 1.9.3 via yari and python 2.7.3 via windows installer. Basically everything has gone smoothly when I installed octopress but the syntax highlighting is really giving me a headache. It was even mentioned in this blog post that there's really an issue with the syntax highlighting in windows:

http://blog.zerosharp.com/setting-up-octopress-on-windows/

But nothing works.

I would really appreciate if you can point some of the mistakes that I did there.

like image 295
user225269 Avatar asked Dec 17 '25 14:12

user225269


1 Answers

Not a direct answer, but perhaps consider simply switching your markdown parser to redcarpet (in _config.yml, set markdown: redcarpet) and then just use Github-flavored markdown's fenced codeblocks to provide the syntax highlighting?

Support for the latest redcarpet that provides github-flavored markdown was only recently added to Jekyll, so you may need to update your Jekyll gem first. Personally I think it makes much more sense to have posts written in pure markdown than to have to use Liquid for syntax highlighting.

like image 52
cboettig Avatar answered Dec 20 '25 11:12

cboettig



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!