Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to escape {{ in markdown on Octopress?

I'm using Octopress to blog, and I want to post the following code snippet (it's Mustache JS syntax):

```
<ul id="beers-list">
    {{#beers}}
        <li>{{name}} - {{color}} - {{alcohol}}%</li>
    {{/beers}}
</ul>
```

Unfortunately, when rendered, all {{...}} disappear, and I see the following on my website:

<ul id="beers-list">

        <li> -  - %</li>

</ul>

I was not able to escape the {{ (even with \{{, {\{ or something like that. Is there a way to escape these characters?

Thanks.

I'm not sure if SO is the better site for this question

like image 971
Romain Linsolas Avatar asked Apr 03 '13 11:04

Romain Linsolas


1 Answers

Thanks to another quite similar question (and answer) here, I've found the solution. I have to wrap my code block with {% raw %} and {% endraw %}:

{% raw %}
```
<ul id="beers-list">
    {{#beers}}
        <li>{{name}} - {{color}} - {{alcohol}}%</li>
    {{/beers}}
</ul>
```
{% endraw %}
like image 60
Romain Linsolas Avatar answered Sep 28 '22 09:09

Romain Linsolas