fazlurr
1/11/2015 - 12:36 PM

Handlebars breaklines helper From : http://stackoverflow.com/a/12397602

Handlebars breaklines helper From : http://stackoverflow.com/a/12397602

Handlebars.registerHelper('breaklines', function(text) {
    text = Handlebars.Utils.escapeExpression(text);
    text = text.replace(/(\r\n|\n|\r)/gm, '<br>');
    return new Handlebars.SafeString(text);
});
<div>
    {{breaklines description}}
</div>