I have a Meteor 0.8.3 app with the template:
<template name="example">
Description: {{desc}}
</template>
and javascript:
Template.example.desc = function(){
return Session.get("desc");
}
where the user has set the Session's desc
.
I want to mark up the text slightly before displaying it, eg. replacing carriage returns with <br>
, and adding some word-breaks (html code ​
).
I believe I could do this with some regex replacements in Template.example.desc
and triple-braces {{{desc}}}
in the template - however, this opens the door to the user entering their own html into the string, which is unsafe. So I'd like to let Meteor first make the string safe, and only then apply my markup.
How do I do it? Thanks!