Log in Sign up

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.


2 years ago, 2 replies   developers   Edit 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 2 years ago · Edit answer

Great, please let me know if anything else comes up

Answered 2 years ago · Edit answer