3
votes

I would like to include a Github gist in an ember handlebars template. However, gists come in the form of script tags and these do not seem to work when inside a template. Just to be clear the gist is entered into a text area and then persisted via firebase. Upon viewing the article the gist does not display. I know about escaping in the template e.g. {{{body}}} however this does not work.

Any suggestions of how to make script tags render/fire within templates would be much appreciated.

1

1 Answers

0
votes

There is no possibility of getting script tags to actually execute within HTMLBars templates unfortunately. As far as I know, there is no way to get around that specifically - but there are alternative approaches, depending on your needs.

One potential approach is to inject the script dynamically during a didInsertElement hook using one of the methods described here: How to dynamically insert a <script> tag via jQuery after page load?

This is not something I recommend doing regularly, but there are special circumstances that cannot be done by conventional means, like this one.