In Jade, I have textarea in a form.
form(action='save')
textarea(name='description')
input(type='submit')
Description is saved to mongodb. Im using mongoosejs for this.
description: String
When rendering jade with the description, I have:
p #{description}
What is the best way to display the description with the linebreak.
There are more ways.
First way - is a change of content and replacing for a <br />:
p !{escape(foo).replace(/\n/g, '<br/>')}
Second way - You can apply custom CSS, so you don't need to replace content and break \n
<style>
p { white-space: pre; }
</style>