https://github.com/minutebase/ember-sanitize
Sanitize user provided HTML in your Ember CLI app
https://github.com/minutebase/ember-sanitize
Last synced: 8 months ago
JSON representation
Sanitize user provided HTML in your Ember CLI app
- Host: GitHub
- URL: https://github.com/minutebase/ember-sanitize
- Owner: minutebase
- License: mit
- Created: 2014-09-14T00:51:51.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2018-11-07T19:09:16.000Z (over 7 years ago)
- Last Synced: 2025-01-31T04:25:52.702Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 42 KB
- Stars: 11
- Watchers: 5
- Forks: 14
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ember-sanitize
An Ember CLI addon to sanitize user provided content using [sanitize.js](https://github.com/gbirke/Sanitize.js).
## Using
### Installation
Install this addon via npm:
```
npm install --save-dev ember-sanitize
```
Then run the generator to install `sanitize.js`:
```
ember generate ember-sanitize
```
### Usage
Simply use the `sanitize-html` helper in your template:
```handlebars
{{sanitize-html someValue}}
```
This will use the most restrictive sanititizer config by default, which will strip all HTML.
To use your own sanitizer configuration, add a file to `/app/sanitizers/` which exports an object
conforming to [sanitizer's configuration options](https://github.com/gbirke/Sanitize.js#configuration).
For example:
```js
// /app/sanitizers/strict.js
export default {
elements: ['b', 'em', 'i', 'strong', 'u']
};
```
You can then use this configuration by passing it in as the second argument to the helper:
```handlebars
{{sanitize-html someValue "strict"}}
```
## Developing
### Installation
* `git clone` this repository
* `npm install`
* `bower install`
### Running
* `ember server`
* Visit your app at http://localhost:4200.
### Running Tests
* `ember test`
* `ember test --server`