I'm storing blog posts in mongodb. Posts can have new lines (stored as \n\r) and/or anchor tags.
{
"header" : "Some header",
"body" : "The first paragraph.\n\rThe second paragraph\n\r<a href=\"www.example.com\" title=\"Example\">Example text</a>",
"languageCode" : "DE"
}
By doing this in my thymeleaf view I can display the new lines:
<p class="card-text" th:utext="${#strings.replace(#strings.escapeXml(blogEntry.blogPost.body),' ','<br>')}"></p>
However the anchor tags are displaying as plain text.
How to format the anchor tag that comes from the controller as an actual link to another site?