Use the HTML5 Purify extension in ThinkJS
npm install think-purifyUse the HTML5 Purify extension in ThinkJS
``bash`
npm install think-purify --save
javascript
const purify = require('think-purify')module.exports = [
purify
];
`
$3
`javascript
module.exports = class extends Base {
indexAction() {
const html = this.post('html');
const result = this.purify(html); // Filtering dangerous html tags and attributes
return this.display();
}
};
``