views:

10

answers:

1

I have code in @snippet.code, and I want to highlight it with harsh:

:harsh
  #!harsh theme = lazy
  = @snippet.code

However, this just highlights @snippet.code, so the output is:

<pre class="lazy"><span class="Keyword">=</span> <span class="Variable"><span class="Variable">@</span>snippet</span>.code&#x000A;</pre>

How can I use Harsh with generated code? Thanks

A: 

You need to print out the contents of @snippet.code

It would help to know what templating engine you are using. Try:

:harsh
  #!harsh theme = lazy
  <%= @snippet.code %>

This should work if erb get to the code before harsh.

thomasfedb
I am using HAML, your code would thus raise a syntax error :)
Time Machine