Line breaks in strapi

On the frontend, try converting your markdown before giving it to your markdown library:

(`1\n2...\n\n3!`).replace(/\n/gi, "  \n")

And use this css:

.line-break {
  white-space: pre-wrap;
}

So if you’re using ReactMarkdown library for example:

<ReactMarkdown className="line-break" children={yourContent.replace(/\n/gi, "&nbsp; \n")} />
2 Likes