Hi,
I'll provide a little more context.
The field is the body text of an email, that has been parsed from an .eml file. I've provided a sample document from the collection below:
meteor:PRIMARY> db.parsed_emails.findOne()
{
"_id" : ObjectId("54eec93569ca9cacf0d76ea2"),
"Body" : "Hello,\r\n\r\nI just completed my two-step verification. Can you please set up the rest\r\nof my G-Mail goodies?\r\n\r\nThank you\r\n_<REMAINDER_TRUNCATED>",
"To" : "B...@example.org",
"BOB_Error" : "\r\n\"Could not find a corresponding issue to comment and 'Create a new issue from each email' is not selected.\"\r\n",
"Sender_Email" : "FOO BAR",
"Sender_Name" : "foo...@example.com",
"Subject" : "Re: [FOOBAR-BAR] Account created",
"Google_Group_URL" : "SANITISED",
"Datetime" : ISODate("2015-02-25T23:21:43Z")
}
In this case, the "body" field contains \n characters to indicate newlines (and a \r). (This is as per the RFC 2822 email spec).
As you say though, HTML isn't going to render "\n" - it will just print it out as a literal. Hence, it needs to be converted either to <p></p>, or to <br> (If anybody is aware of another option, please let me know.)
So my question is, if I want to render the "body" field in a Meteor template, what is most idiomatic way to do so in Meteor?
Rails and Django both have inbuilt filters to do this - Rails has simple_format
Django has linebreaks:
Is this something that would be an inbuilt part of Meteor? Or is there already an idiomatic way to do this with just the Meteor stdlib?
Cheers,
Victor