How to Store html with Line Wrap in mongodb Database
Recently, I have time to try to write the background of my blog. When saving the internal pages of my blog, I used markdown to write it, and then saved the parsed html into mongodb database. This is when the problem comes ~
Suppose my markdown code looks like this
Little by little //The first line of code //The second line of code Little by little
The compiled code has a line feed structure
<p> <code> //The first line of code //The second line of code </code> </p>
Html like this cannot be stored in mongodb database fields, so I compressed it
< p><code>// first line code//second line code < /code></p >
This structure can be saved, but it makes the code lose line breaks and indents, making it difficult to read (especially when there is a large amount of code)
My current solution is to manually replace the line feed part of my code
\nAnd spaces, is there a better solution?
Who said that if there is a line break, it cannot be saved?