Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/licitdev/directus-extension-sanitize-html
Directus custom extension to sanitize HTML inputs
https://github.com/licitdev/directus-extension-sanitize-html
Last synced: 2 months ago
JSON representation
Directus custom extension to sanitize HTML inputs
- Host: GitHub
- URL: https://github.com/licitdev/directus-extension-sanitize-html
- Owner: licitdev
- License: gpl-3.0
- Created: 2022-09-09T16:44:21.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-18T15:59:01.000Z (over 2 years ago)
- Last Synced: 2024-05-01T14:38:09.681Z (8 months ago)
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/directus-extension-sanitize-html
- Size: 194 KB
- Stars: 7
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
- awesome-directus - Sanitize HTML - Sanitize HTML inputs to Directus. (Extensions / Community)
README
# Directus Extension - Sanitize HTML
Sanitize HTML inputs with the [sanitize-html](https://www.npmjs.com/package/sanitize-html) package.
[![NPM version][npm-version-image]][npm-url] [![License][license-image]][license-url]
[![NPM downloads][npm-downloads-image]][npm-url]## Installation
```
npm install directus-extension-sanitize-html
```## Options
### Customize which event scopes to sanitize
Add the `EXT_SANITIZE_HTML_EVENT_SCOPES` environment variable with the event scopes separated by commas.
Defaults to running `items.create,items.update`.
Example: `articles.items.create,articles.items.update`
### Customize which paths to omit for sanitization
Add the `EXT_SANITIZE_HTML_OMIT_PATHS` environment variable with the `.path` separated by commas.
Defaults to no path to omit.
Example: `articles.content,website.rawHtml`
### Customize which HTML tags are allowed
Add the `EXT_SANITIZE_HTML_ALLOWED_TAGS` environment variable with the `` separated by commas.
Defaults to `undefined`, using the defaults from `sanitize-html`.
Example: `a,b,i,em,strong`
### Customize the action taken for disallowed tags
Add the `EXT_SANITIZE_HTML_DISALLOWED_TAGS_MODE` environment variable with `discard`, `escape` or `recursiveEscape`.
Defaults to `undefined`, using the defaults from `sanitize-html`.
Example: `escape`
## License
GPLv3 License. See the [LICENSE](LICENSE) file.
[npm-downloads-image]: https://img.shields.io/npm/dm/directus-extension-sanitize-html.svg?style=flat-square
[npm-version-image]: https://img.shields.io/npm/v/directus-extension-sanitize-html.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/directus-extension-sanitize-html
[license-url]: https://github.com/licitdev/directus-extension-sanitize-html/blob/main/LICENSE
[license-image]: https://img.shields.io/npm/l/directus-extension-sanitize-html.svg?style=flat-square