Skip to content

weihongyu12/think-purify

Repository files navigation

think-purify

npm Build Status Coverage Status

Use the HTML5 Purify extension in ThinkJS

How to use

Install

npm install think-purify --save

Configure extends.js

const purify = require('think-purify')

module.exports = [
  purify
];

Use in controller, service, context or think

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();
  }
};

About

Use the HTML5 Purify extension in thinkjs

Resources

License

Stars

Watchers

Forks

Packages

No packages published