https://github.com/weihongyu12/think-purify
Use the HTML5 Purify extension in thinkjs
https://github.com/weihongyu12/think-purify
Last synced: 5 months ago
JSON representation
Use the HTML5 Purify extension in thinkjs
- Host: GitHub
- URL: https://github.com/weihongyu12/think-purify
- Owner: weihongyu12
- License: mit
- Created: 2017-11-02T08:45:01.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2020-07-25T03:06:35.000Z (over 4 years ago)
- Last Synced: 2024-10-03T21:16:02.571Z (7 months ago)
- Language: JavaScript
- Size: 418 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- think-awesome - think-purify
README
# think-purify
[](https://www.npmjs.com/package/think-purify)
[](https://travis-ci.org/weihongyu12/think-purify)
[](https://coveralls.io/github/weihongyu12/think-purify?branch=master)Use the [HTML5 Purify](https://www.npmjs.com/package/html-purify) extension in ThinkJS
## How to use
### Install
```bash
npm install think-purify --save
```### Configure extends.js
```javascript
const purify = require('think-purify')module.exports = [
purify
];
```
### Use in controller, service, context or think```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();
}
};
```