0

I have some markdown in Morea which includes an example Jinja2 template. It looks like this:

{% highlight html linenos %}
<!doctype html>
<html>
<body>
    <p> {{ greet }}, {{ place }} </p>
</body>
</html>
{% endhighlight %}

I would like to be able to display the double curly braces, but they get swallowed up, displaying nothing but the paragraph tags and the comma, like this:

<p>  ,   </p>

I followed some advice to use the {% raw %} and {% endraw %} tags around that line, but nothing changes. Seems like a bug. Anyone have any tricks?

Rob
  • 14,746
  • 28
  • 47
  • 65
Allan Anderson
  • 574
  • 4
  • 15
  • I've found a crazy way to do that [here](http://stackoverflow.com/questions/3426182/how-to-escape-liquid-template-tags#answer-5866429). Perhaps can be helpful in your case. – Virtua Creative Mar 31 '16 at 03:42

3 Answers3

1

Surround code containing curly braces with the raw tag :

{% highlight html linenos %}
{% raw %}
<!doctype html>
<html>
<body>
    <p> {{ greet }}, {{ place }} </p>
</body>
</html>
{% endraw %}
{% endhighlight %}
David Jacquel
  • 51,670
  • 6
  • 121
  • 147
  • Could you post a screen image showing this approach working with a [Morea Framework](http://morea-framework.github.io) site? It didn't work for the original poster or for me. – Philip Johnson Mar 30 '16 at 17:00
  • @PhilipJohnson I'll be plesed to help you. Can you provide a repository url ? I'll try to spot the problem. – David Jacquel Mar 30 '16 at 17:53
  • Thanks. A sample repo is [basic-template2 repo](https://github.com/morea-framework/basic-template2) with corresponding [basic-template2 site](http://morea-framework.github.io/basic-template2/). After cloning, you might want to try fiddling with the [MathJax samples](https://github.com/morea-framework/basic-template2/blob/master/src/morea/foo/reading-1.md) page source. – Philip Johnson Mar 31 '16 at 00:28
  • Sorry but `{%raw%}\\[ \frac{1}{n^{2}} \\]{%endraw}` works perfectly here. – David Jacquel Mar 31 '16 at 10:12
  • Exactly. So why doesn't `{%raw%} {{ greet }} {%endraw}` work perfectly as well? – Philip Johnson Mar 31 '16 at 18:31
  • Can you, please, write a dedicated question that describes your input, your expected output, and the problem you're facing. Comments are not supposed to be a resolution way on SO. – David Jacquel Mar 31 '16 at 20:19
  • Hi David! My question above has an example of my input and describes my expected output. {%raw%} isn't working for me when using the morea-framework. Is there anything I should add or change to make it more useful? – Allan Anderson Apr 04 '16 at 21:51
  • you ended my two-day misery!! +1 – Cna Feb 17 '20 at 08:11
0

Eek. There appears to be some double-escaping going on with the Morea plugin. The only solution I can come up with quickly is to embed a gist with the code containing the offending liquid tag. Here is a sample page illustrating this approach:

enter image description here

I will continue to look into this. Note that to embed gists you'll need to install the jekyll-gist gem and then add the following to your config.yml:

gems: - jekyll-gist

Philip Johnson
  • 1,463
  • 2
  • 11
  • 20
0

This should work :

```
{% raw %}
<!doctype html>
<html>
<body>
    <p> {{ greet }}, {{ place }} </p>
</body>
</html>
{% endraw %}
```
Grace Shi
  • 1
  • 2