Is it possible to output processed and unprocessed blocks in handlebars?

61 views Asked by At

I'm trying to create a helper that renders the html for a partial block and generates a code example of that partial.

for example this:

<div class="wrapper">
  {{> first}}
  {{> second}}
</div>

should produce this:

html:
----------
<div class="wrapper">
  <div>first</div>
  <div>second</div>
</div>
----------
example:
----------
<div class="wrapper">
  {{> first}}
  {{> second}}
</div>

I can use a {{{{raw}}}} block helper or \{{{escape}}}}, this works for the example but not the html. Is there a way to output both without repeating my self in the code like this:

<div class="wrapper">
  {{> first}}
  {{> second}}
</div>

<div class="wrapper">
  \{{> first}}
  \{{> second}}
</div>

Is this possible?

1

There are 1 answers

0
AudioBubble On BEST ANSWER

If anyone else run into this issue it was solved here.

https://github.com/wycats/handlebars.js/issues/1385