egg-html-purify

HTML5 Purifier plugin for egg.js

Usage no npm install needed!

<script type="module">
  import eggHtmlPurify from 'https://cdn.skypack.dev/egg-html-purify';
</script>

README

egg-html-purify

NPM version build status Test coverage David deps Known Vulnerabilities npm download

HTML5 Purifier plugin for egg.js

The plugin uses a whitelist based approach to filter malicious characters,tags, attributes and attribute values while keeping the resulting output HTML5 compliant.

Install

$ npm i egg-html-purify --save

Usage

// {app_root}/config/plugin.js
exports.htmlPurify = {
  enable: true,
  package: 'egg-html-purify',
};

Example

this.app.purify(input);

// or use in context
this.ctx.purify(input);

Questions & Suggestions

Please open an issue here.

License

MIT