Handlebars.js使用noEscape选项禁用转义? [英] Handlebars.js disable escaping with noEscape option?
问题描述
我已将所有内容预先转义出来,所以我不想在全球范围内使用三重存储,而是想全局禁用转义转义。快速搜索显示了类似的功能,我可以在我的构建手柄中看到,但是我不知道如何打开它。
I have all my content pre-escaped, so rather than using the triple stash everywhere i would like to globally disable handlebars escaping. A quick search showed a similar feature which I can see in my build of handlebars, however I don't know how to turn it on.
请求的请求位于:
https://github.com/wycats/handlebars.js/pull/121
我试过在我的代码中添加Handlebars.Compiler.options.noEscape = true,但它总是返回未定义的选项。即使在确定选项之后,它也没有选择它。有谁知道我应该如何在脚本文件中启用此选项?谢谢
I've tried adding Handlebars.Compiler.options.noEscape = true in my code but it always comes back with options undefined. Even after defining the options its not picking it up. Does anyone know how I should be enabling this option in my script file? Thanks
推荐答案
试试这样:
Try something like this:
var template = Handlebars.compile(source, {noEscape: true});
这篇关于Handlebars.js使用noEscape选项禁用转义?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!