How to escape code blocks in Jekyll

If you paste code into highlightjs blocks in Jekyll templates, you can get errors like this:

Error: Liquid syntax error: 
Variable '{{{ * val mybreaks = new Breaks * 
import mybreaks.{break, breakable}' 
was not properly terminated with regexp: /\}\}/

Error: Run jekyll build --trace for more information.
Regenerating: 1 file(s) changed at 2016-02-21 16:29:07   

Liquid Exception: Liquid syntax error: 

Variable '{{{ * val mybreaks = 
new Breaks * import mybreaks.{break, breakable}' 
was not properly terminated with regexp: /\}\}/ 
in /Users/gary/scaladoc-jekyll/_posts/2016-02-15-
scala__util_control_Breaks_TryBlock.md
...error:

The way to fix this is to use the “raw” tag:

{% highlight scala %}
{% raw %}
if (x) {
}
{% endraw %}
{% endhighlight %}