How to deactivate Ruby code from executing when it is used inside a code example highlighted with pygments

When you want to highlight ruby-code snippets you will deal with the problem that the code, even when it is wrapped inside the {% highlight ruby linenos %}…{% endhighlight %} tags, it gets executed and you do not see the code snippet itself.

To overcome this problem you can use the {% raw %}… tag and wrap the ruby code inside it. This will deactivate the code from running and it will just print the code to the screens of your visitors.

Consider the following example, which uses the {% raw %} tag:

{% for tag in site.tags %}
{% endfor %}
comments powered by Disqus