So I tried converting the Markdown file and sending it via Rest API and then rendering it on the frontend. The problem is that newlines and other content are lost when trying to convert them back.
How do I render it in a way that preserves the original markdown?
Is there a standard way to do this?
Tried converting markdown via json.stringify, sent via api, tried converting it back to markdown, but no longer works like the original.
You can add everything in
tag as following
In
<pre>
tags, the text preserves spaces and newlines, so it will appear exactly as written in the HTML source code.You can send the original file as a string, or if this is not an option, you can use this function to format the object: