You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add test for blocking multiple elements
* Fix sanitizer for nested blocked elements
* Add new `unblockElements` option to sanitizer
* Add bug fix changeset
* Add feature changeset
* Refactor
* Cleanup
---------
Co-authored-by: Nate Moore <[email protected]>
Adds a new `unblockElements` option to the `sanitize` transformer. This option makes it easier to remove all or most HTML from a string without dropping child content.
| allowElements |`string[]`|`undefined`| An array of strings indicating elements that the sanitizer should not remove. All elements not in the array will be dropped. |
107
107
| blockElements |`string[]`|`undefined`| An array of strings indicating elements that the sanitizer should remove, but keep their child elements. |
108
+
| unblockElements |`string[]`|`undefined`| An array of strings indicating elements that the sanitizer should not remove. All elements not in the array will be removed, but keep their child content. |
108
109
| dropElements |`string[]`|`["script"]`| An array of strings indicating elements (including nested elements) that the sanitizer should remove. |
109
110
| allowAttributes |`Record<string, string[]>`|`undefined`| An object where each key is the attribute name and the value is an Array of allowed tag names. Matching attributes will not be removed. All attributes that are not in the array will be dropped. |
110
111
| dropAttributes |`Record<string, string[]>`|`undefined`| An object where each key is the attribute name and the value is an Array of dropped tag names. Matching attributes will be removed. |
/** An Array of strings indicating elements that the sanitizer should not remove. All elements not in the array will be dropped. */
5
5
allowElements?: string[];
6
+
/** An Array of strings indicating elements that the sanitizer should not remove. All elements not in the array will be removed while keeping their child content. */
7
+
unblockElements?: string[];
6
8
/** An Array of strings indicating elements that the sanitizer should remove, but keeping their child elements. */
7
9
blockElements?: string[];
8
10
/** An Array of strings indicating elements (including nested elements) that the sanitizer should remove. */
0 commit comments