I would like to write {{ ... }}
inside a code block using Markdown.
For example:
{{ var }}
I don't know why it disappears. However I can write it outside a block of code: \ {\ { var \ } \ }.
I would like to write {{ ... }}
inside a code block using Markdown.
For example:
{{ var }}
I don't know why it disappears. However I can write it outside a block of code: \ {\ { var \ } \ }.
You should be able to do exactly that. I think you must be using a bugged markdown implementation (or one with a 'templating mechanism' where {{ xxx }} is treated like variable interpolation), in normal markdown the following code block should work:
{{ var }}
As you can see, the StackOverflow markdown processor is doing the right thing, it is putting {{ var }}
verbatim in the code block.
If you are using Jekyll to create your github pages, be aware that {{ }} is used for variable interpolation. Jekyll uses Liquid for this. Documentation:
Your answer is probably here (there are multiple options): How to escape liquid template tags?
You could use something like this.
{% highlight liquid %}
{% raw %}
{{ Your code here }}
{% endraw %}
{% endhighlight %}
This will output the following code:
<code class="language-liquid" data-lang="liquid">
<span class="p">{{</span>
<span class="w"> </span>
<span class="nv">Your code here</span>
<span class="w"> </span>
<span class="p">}}</span>
</code>