Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>We can't do custom delimiters (a shortcoming of Handlebars), but there are a couple of solutions that might work for you. Neither is necessarily idiomatic, so you be the judge of how suitable these are for the project you're working on.</p> <p><strong>string replacement</strong></p> <p>You could use some custom (temporary) delimiters for the templates in the content that shouldn't be compiled, then create a block helper that will convert those delimiters back to valid handlebars expressions during compile time (I tested this for this answer and it works):</p> <p>For example:</p> <pre><code>Handlebars.registerHelper("raw", function(options) { return options.fn(this).replace(/\[\[/g, '{{').replace(/\]\]/g, '}}'); }); </code></pre> <p>Then use it like this:</p> <pre><code>{{#raw}} {{&gt; foo }} {{/raw}} </code></pre> <p>Inside <code>foo.hbs</code>, you might have something like this:</p> <pre><code>&lt;title&gt;[[title]]&lt;/title&gt; </code></pre> <p>and it will render to:</p> <pre><code>&lt;title&gt;{{title}}&lt;/title&gt; </code></pre> <p>This solution is hacky for sure, and you might have problems if you happen have any code examples embedded in the included content and one of the examples happens to have that syntax (like <code>[0,1,[foo, bar]]</code>. </p> <p><strong>escaping</strong></p> <p>This solution is most likely the better way to go. Handlebars will not evaluate any templates that are preceded by <code>\</code>. So you can do this:</p> <pre><code>&lt;title&gt;\{{title}}&lt;/title&gt; </code></pre> <p>and it will render to:</p> <pre><code>&lt;title&gt;{{title}}&lt;/title&gt; </code></pre> <p>The first suggestion probably wasn't even worth adding, but hey, you never know right?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload