user225269
user225269

Reputation: 10893

Syntax highlighting in octopress

What do I need to do to make syntax highlighting work on octopress? Here's what I currently have:

``` ruby 
 class Fixnum
   def prime?
     ('1' * self) !~ /^1?$|^(11+?)\1+$/
   end
 end
```

There's no whitespace on the left side of the backtick and I place a single whitespace between the leftmost part of the editor and the code which I want to be highlighted.

I also tried codeblocks but no luck even if I already copy pasted the example on their site:

{% codeblock lang:objc %}
[rectangle setX: 10 y: 10 width: 20 height: 20];
{% endcodeblock %}

Is there anything else that I need to install? I believe codeblocks and backticks are already included when I installed octopress. But it still looks like this even if I include the language:

enter image description here Any ideas?

Upvotes: 3

Views: 3283

Answers (2)

alestanis
alestanis

Reputation: 21863

Have you solved your issue?

If not, you can try using different markdown engines (default is rdiscount + pygments).

Other possible engines are kramdown, redcarpet and maruku, which use ruby instead of python, so if you have issues with python this might solve them.

I wrote a blog post about how to set up kramdown with Octopress, you can check it out.

Upvotes: 3

Snger
Snger

Reputation: 1384

  • A Sass port of Solarized syntax highlighting created specifically for Octopress.
  • Gist code embedding - by Brandon Tilly.
  • Insert code snippets from your filesystem with a download link.
  • Easy inline code blocks with <figure> and <figcaption> and optional download links.
  • Pygments caching - a Jekyll community plugin.
  • Table based line numbers added with javascript.

Octopress Sharing Code Snippets

Upvotes: 2

Related Questions