How to make a html page from CKeditor

Issue

I am creating a News Blog Website. For composing new blog in the website, I am using Ckeditor as Rich Text Editor. I am using ejs as my view engine, I am using node.js and also express.js

<form action="/compose" method="post">
        <div class="form-group">
            <label>Post</label>
            <textarea name="postBody" id="editor">Start Writing Here.</textarea>
        </div>
        <button type="submit" class="btn btn-primary">Publish</button>
    </form>

    <script>
        ClassicEditor
            .create(document.querySelector('#editor'))
            .then(editor => {
                console.log(editor);
            })
            .catch(error => {
                console.error(error);
            });
    </script>

Now I am using this data and creating a post page

<%= content %>

but when I am opening my post website, I am getting my post content in raw HTML format as shown below

<p><strong>Lorem ipsum</strong> dolor sit amet, consectetur adipisicing elit.<i> Quae maxime</i> dolore necessitatibus iste aliquid dolorum in nostrum repellat rerum atque?</p>

how can I get it in plain text with all the tags applied to it.
For eg:- I want like this

Lorem ipsum dolor sit amet, consectetur adipisicing elit.Quae maxime dolore necessitatibus iste aliquid dolorum in nostrum repellat rerum atque?
Please help me, sorry for my english or my silly question.

Solution

Use this:

<%- content %>

instead of this:

<%= content %>

Answered By – Konrad Linkowski

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published