From fb58d2dce9ef353745ee037bf864b59e588dc30c Mon Sep 17 00:00:00 2001 From: Cure53 Date: Sat, 13 Aug 2022 16:37:49 +0200 Subject: [PATCH] docs: Added instructions for Angular, see #705 --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 96640b54..008481cd 100644 --- a/README.md +++ b/README.md @@ -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('hello there'); +``` + 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: