Code Monkey home page Code Monkey logo

Comments (6)

rphlmr avatar rphlmr commented on June 27, 2024

Ok I found that we have to add one more curly braces pair to escape specials char :D

Mail subject should be : "Welcome to {{{name}}}"

https://handlebarsjs.com/#html-escaping

from extensions.

Ehesp avatar Ehesp commented on June 27, 2024

@rphlmr Thanks for the feedback. Looks like you're right yeah, the triple-stash should work in this case.

I'll get a PR sent up soon with the changes (unless you wanted to take a go?).

from extensions.

Ehesp avatar Ehesp commented on June 27, 2024

Actually, I was thinking we could set this in the template compiler, however re-reading what you said I think this is a documentation update.

Maybe in the docs we could add a line below the example:

By default, the extension HTML-escapes values returned by a `{{expression}}`. If you don't want to escape a value, use the "triple-stash", `{{{`.

Taken from: https://handlebarsjs.com/#html-escaping

cc @rachelsaunders

from extensions.

rphlmr avatar rphlmr commented on June 27, 2024

Yes, I think it should be only on the documentation.
It's easier to put it in the template compiler (and transparent for fast doc readers), but if someone wants to escape, it'll no more be configurable.

Last question, do you know why it works without triple-stash in the template body ? (actually it seems that we have 2 diffents behaviours :p )

from extensions.

rachelsaunders avatar rachelsaunders commented on June 27, 2024
  1. It'd be great to learn the answer to the question from @rphlmr above.

  2. A clarification question - this HTML-escaping syntax is only applicable for templates, right?

  3. If (2) is true... Since the HTML-escaping syntax is already documented in the handlebar template documentation, I'd prefer to not repeat it in our docs. It seems pretty easy to find in their docs with a quick ctrl-f of their page. If we document this syntax in our docs, then we'd be going down the road of documenting all their syntax.

from extensions.

Ehesp avatar Ehesp commented on June 27, 2024
  1. It'd be great to learn the answer to the question from @rphlmr above.

So the reason the subject & body have different functionality is how the email client is handling the data. Your body content will be getting escaped by handlebars, but your email client will be then parsing the HTML entities back into valid HTML (as HTML is allowed in the body).

In the subject, only a string is allowed, so it displays the escaped output handlebars generated.

  1. A clarification question - this HTML-escaping syntax is only applicable for templates, right?

Yep, it's applied to the subject, html/text/amp properties sent on each email.

  1. If (2) is true... Since the HTML-escaping syntax is already documented in the handlebar template documentation, I'd prefer to not repeat it in our docs. It seems pretty easy to find in their docs with a quick ctrl-f of their page. If we document this syntax in our docs, then we'd be going down the road of documenting all their syntax.

Makes sense, I'll go ahead and close this issue along with the PR.

from extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.