Ejs Rendering Html
I've got a simple blog app on Express and MongoDB, using EJS to render my data. The problem I have is I want this to be styled like a paragraph:
Solution 1:
To be honest, I had the similar issue a week ago
Mission was to disable javascript. I did that with sanitizer.
I sanitized user info before inserting in MongoDB.
So recommend you to do that with sanitize-html
striptags
.
Those packages are in npm you can download the package.
I hope you will solve the problem.
var striptags = require('striptags');
YourCollectionName.find({}, function (err, obj) {
if (err) {
//handle or throw error
}
// For all the documents, remove html tags and save
obj.forEach(function(ob){
ob.body= striptags(ob.body);
ob.save();
});
});
Post a Comment for "Ejs Rendering Html"