Skip to content

Commit

Permalink
docs: Added instructions for Angular, see #705
Browse files Browse the repository at this point in the history
  • Loading branch information
cure53 committed Aug 13, 2022
1 parent 4f62dcd commit fb58d2d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions README.md
Expand Up @@ -40,6 +40,14 @@ Afterwards you can sanitize strings by executing the following code:
let clean = DOMPurify.sanitize(dirty);
```

Or maybe this, if you love working with Angular or alike:

```js
import * as DOMPurify from 'dompurify'

let clean = DOMPurify.sanitize('<b>hello there</b>');
```

The resulting HTML can be written into a DOM element using `innerHTML` or the DOM using `document.write()`. That is fully up to you.
Note that by default, we permit HTML, SVG **and** MathML. If you only need HTML, which might be a very common use-case, you can easily set that up as well:

Expand Down

0 comments on commit fb58d2d

Please sign in to comment.