I have a webpage containing a text editor(tinymce), which does nice formatting to the text and then stores it in the database. The server retrieves this formatted text from database and sends it to a webpage (ejs template). But HTML tags are not considered and plain text is rendered on the webpage.
<p style="text-align=center;">Hello,World</p>
This p tag is stored in database and while rendering it on webpage, it is rendered as plain text, without p tag functionality. How can I render HTML content sent by server?
CodePudding user response:
you can preserve the indentation by using the pre HTML tags. So wrap the code that you want to display online using the (< pre>pre html tags), some more documentaion on that here: https://devpractical.com/display-html-tags-as-plain-text/
CodePudding user response:
Just use the syntax <%- your value %>
for example:
your_value = <p style="text-align=center;">Hello,World</p>
if you render the value like this:
<%= your_value %>
You will get the output as text. But if you render it like this:
<%- your_value %>
you will get only "Hello,World".