sanitize-html 1.21.0 → 1.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -1
- package/README.md +8 -6
- package/dist/sanitize-html-es2015.js +2996 -3493
- package/dist/sanitize-html.js +234 -290
- package/dist/sanitize-html.min.js +1 -1
- package/package.json +23 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
## Changelog
|
|
2
2
|
|
|
3
|
+
1.23.0:
|
|
4
|
+
- Adds eslint configuration and adds eslint to test script.
|
|
5
|
+
- Sets `sideEffects: false` on package.json to allow module bundlers like webpack tree-shake this module and all the dependencies from client build. Thanks to [Egor Voronov](https://github.com/egorvoronov) for the contribution.
|
|
6
|
+
- Adds the `tagName` (HTML element name) as a second parameter passed to `textFilter`. Thanks to [Slava](https://github.com/slavaGanzin) for the contribution.
|
|
7
|
+
|
|
8
|
+
1.22.1: Increases the patch version of `lodash.mergewith` to enforce an audit fix.
|
|
9
|
+
|
|
10
|
+
1.22.0: bumped `htmlparser2` dependency to the 4.x series. This fixes longstanding bugs and should cause no bc breaks for this module, since the only bc breaks upstream are in regard to features we don't expose in this module.
|
|
11
|
+
|
|
12
|
+
1.21.1: fixed issue with bad `main` setting in package.json that broke 1.21.0.
|
|
13
|
+
|
|
3
14
|
1.21.0: new `disallowedTagsMode` option can be set to `escape` to escape disallowed tags rather than discarding them. Any subtags are handled as usual. If you want to recursively escape them too, you can set `disallowedTagsMode` to `recursiveEscape`. Thanks to Yehonatan Zecharia for this contribution.
|
|
4
15
|
|
|
5
16
|
1.20.1: Fix failing tests, add CircleCI config
|
|
@@ -79,7 +90,7 @@ Please note that running `sanitize-html` in the browser is usually a security ho
|
|
|
79
90
|
|
|
80
91
|
1.14.2: protocol-relative URL detection must spot URLs starting with `\\` rather than `//` due to ages-old tolerance features of web browsers, intended for sleepy Windows developers. Thanks to Martin Bajanik.
|
|
81
92
|
|
|
82
|
-
1.14.1: documented `allowProtocolRelative` option. No code changes from 1.14.0, released a few moments ago.
|
|
93
|
+
1.14.1: documented `allowProtocolRelative` option. No code changes from 1.14.0, released a few moments ago.
|
|
83
94
|
|
|
84
95
|
1.14.0: the new `allowProtocolRelative` option, which is set to `true` by default, allows you to decline to accept URLs that start with `//` and thus point to a different host using the current protocol. If you do **not** want to permit this, set this option to `false`. This is fully backwards compatible because the default behavior is to allow them. Thanks to Luke Bernard.
|
|
85
96
|
|
package/README.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# sanitize-html
|
|
2
2
|
|
|
3
|
-
[](https://circleci.com/gh/apostrophecms/sanitize-html/tree/master)
|
|
4
4
|
|
|
5
|
-
<a href="https://apostrophecms.
|
|
5
|
+
<a href="https://apostrophecms.com/"><img src="https://raw.github.com/apostrophecms/sanitize-html/master/logos/logo-box-madefor.png" align="right" /></a>
|
|
6
6
|
|
|
7
7
|
`sanitize-html` provides a simple HTML sanitizer with a clear API.
|
|
8
8
|
|
|
@@ -318,7 +318,9 @@ We can do that with the following filter:
|
|
|
318
318
|
sanitizeHtml(
|
|
319
319
|
'<p>some text...</p>',
|
|
320
320
|
{
|
|
321
|
-
textFilter: function(text) {
|
|
321
|
+
textFilter: function(text, tagName) {
|
|
322
|
+
if (['a'].indexOf(tagName) > -1) return //Skip anchor tags
|
|
323
|
+
|
|
322
324
|
return text.replace(/\.\.\./, '…');
|
|
323
325
|
}
|
|
324
326
|
}
|
|
@@ -515,10 +517,10 @@ Valid values are: `'discard'` (default), `'escape'` (escape the tag) and `'recur
|
|
|
515
517
|
|
|
516
518
|
## Changelog
|
|
517
519
|
|
|
518
|
-
[The changelog is now in a separate file for readability.](https://github.com/
|
|
520
|
+
[The changelog is now in a separate file for readability.](https://github.com/apostrophecms/sanitize-html/blob/master/CHANGELOG.md)
|
|
519
521
|
|
|
520
522
|
## Support
|
|
521
523
|
|
|
522
|
-
Feel free to open issues on [github](http://github.com/
|
|
524
|
+
Feel free to open issues on [github](http://github.com/apostrophecms/sanitize-html).
|
|
523
525
|
|
|
524
|
-
<a href="http://
|
|
526
|
+
<a href="http://apostrophecms.com/"><img src="https://raw.github.com/apostrophecms/sanitize-html/master/logos/logo-box-builtby.png" /></a>
|