Your sites Log in Sign up Menu

How to render raw moustache?

Let's say I want to embed some moustache code into a blog post, how do I do that?

If I enter:

<h1>{{ title }}</h1>

The output on the frontend us just:

<h1></h1>

This is because Blot is trying to render the tag. I've tried changing the brackets to the unicode equivalent, but that didn't work. When I used Jekyll, I could wrap the code blocks in {{ raw }} to tell Jekyll not to try and render those elements.

Does mustache have anything similar? I can't find anything in their docs.


a year ago, 2 replies   developers   Improve this question

I asked on the Moustache GitHub repo and got the answer I needed. In case anyone else needs it, here's how you escape Moustache:

{{=<% %>=}} 
    .....MY ESCAPED MOUSTACHE...
 <%={{ }}=%>

Tested and worked fine for me.

Answered a year ago · Improve this answer

Great, please let me know if anything else comes up

Answered a year ago · Improve this answer