I've stored a document with a string field in MongoDB Atlas that I use to populate to an HTML (pug) element. I want to indicate a new line in the text using the escape \n. However, the character does not perform the escape and populates the '\n' with the text in HTML, instead of starting a new line of text.
JSON in Mongodb Atlas
{
"mystring" : "I want this to be two lines. \n Two lines would be great"
}
PUG code:
p!= data.mystring
Renders in HTML as:
I want this to be two lines. \n Two lines would be great
Desired Render in HTML:
I want this to be two lines.
Two lines would be great
FWIW, this worked just fine when I was hosting on MLab. But, we're forced to migrate to Atlas and the same \n escape doesn't seem to work.