<pre> worked fine for me until I had a long text. By default, it disables line wrapping, and long lines break the page layout or crop.
Perhaps you will get around it with white-space: pre-wrap; , but what I ended up with was creating a Spacebars-Helper helper that first eludes the text and then replaces all the breaks with <br/>
UI.registerHelper('breaklines', function(text, options) { text = s.escapeHTML(text); text = text.replace(/(\r\n|\n|\r)/gm, '<br/>'); return new Spacebars.SafeString(text); });
Then I used the helper in my templates as follows:
{{breaklines title}}
escapeHTML is part of Underscore.string, a set of string manipulation extensions that you can use with meteor add underscorestring:underscore.string , but any other way to escape html should work just as well.
source share