MongoDB and Razor Engine CSS hack

So I've built the new site using NancyFX and MongoDB as the DB running on a Linux box. I hit a problem as I'm using the NancyFX Razor viewengine to display the content and placing html <br/> tags in for lines breaks doesn't work. So you may ask how do you accomplish this simple thing. Well the answer is simple use a CSS trick to accomplish it. This is the CSS you need <p style="white-space: pre-line"> @Model.Content </p> Now any carriage returns which are stored as "/r/n" in MongoDB will be displayed as a line break. Simple but effective

11.12.2014 21:29:00
mongodb razor csharp