-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when using ~
within {{{...}}}
#2039
Comments
The following works: const Handlebars = require('handlebars');
var tpl = Handlebars.compile("123\n{{~{myvar}}}\n123");
tpl({myvar: '<myvar>'}); I guess we should document this. I'm also not sure if this is in a specification. |
Similar issue:
This causes an error, and |
@danny0838 What is your expected output here? |
Shouldn't it work normally to trim white spaces at the side? Or is there an alternative way to do this? |
All I can say is it doesn't work (there are also no tests for whitespace-control in raw blocks). I'm not sure if it should work or if the user should just use a helper that trims the raw string accordingly: Handlebars.registerHelper('raw', function(options) {
return options.fn().trim()
}); |
trim doesn't work for such case as it removes white spaces between This issue is raised as such behavior seems like a bug (or at least inconsistent and counterintuitive). Is there any rationale to not implement |
Example 1:
Code:
Result:
Example 2:
Code:
Result:
Node.js: v21.6.2
handlebars: v4.7.8
The text was updated successfully, but these errors were encountered: