How to prevent mustache from encoding the url value?
fzn0x opened this issue · comments
fzn0x commented
How to prevent mustache from encoding the url value?
const stringDoc = Mustache.render("This is your {{ endpoint }}", {
endpoint: "https://loli.dev",
});
console.log(stringDoc); // https://loli.dev
Expected value
This is your https://loli.dev
fzn0x commented
Decoding the result solve my issue, if it's still the part of the mustache issue, you can reopen it.
stringDoc = stringDoc.replace(REG_HEX, function (match, group) {
var num = parseInt(group, 16); //=> 39
return String.fromCharCode(num); //=> '
});
console.log(stringDoc);
Happy hacking!
Phillip Johnsen commented
This is your {{{ endpoint }}}
Was not an option to avoid HTML escaping completely?
fzn0x commented
This is your {{{ endpoint }}}
Was not an option to avoid HTML escaping completely?
Wow, you are right haha. I missed that part in the docs! 😄
fzn0x commented
Thank you!
Phillip Johnsen commented
No worries, I'd say it's yet another hint to improve docs 😬
You're certainly not the first one who's asked and been surprised the
built-in HTML encoding can be avoided when needed.
…On Fri, 9 Sept 2022 at 16:51, Muhammad Fauzan ***@***.***> wrote:
Thank you!
—
Reply to this email directly, view it on GitHub
<#806 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJMWE3EYWTS6AK63JWJZ4TV5NFHPANCNFSM6AAAAAAQINLP3A>
.
You are receiving this because you commented.Message ID: <janl/mustache.
***@***.***>