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
Copy file name to clipboardexpand all lines: README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -39,7 +39,7 @@ Also read about:
39
39
40
40
## Usage
41
41
42
-
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨
42
+
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
Copy file name to clipboardexpand all lines: docs/README.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ These documentation pages are also rendered using marked 💯
25
25
26
26
<h2id="usage">Usage</h2>
27
27
28
-
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML by default 🚨
28
+
### Warning: 🚨 Marked does not [sanitize](https://marked.js.org/#/USING_ADVANCED.md#options) the output HTML. Please use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! 🚨
|mangle |`boolean`|`true`|v0.3.4 |If true, autolinked email address is escaped with HTML character references.|
51
51
|pedantic |`boolean`|`false`|v0.2.1 |If true, conform to the original `markdown.pl` as much as possible. Don't fix original markdown bugs or behavior. Turns off and overrides `gfm`.|
52
52
|renderer |`object`|`new Renderer()`|v0.3.0|An object containing functions to render tokens to HTML. See [extensibility](USING_PRO.md) for more details.|
53
-
|sanitize |`boolean`|`false`|v0.2.1 |If true, sanitize the HTML passed into `markdownString` with the `sanitizer` function.|
53
+
|sanitize |`boolean`|`false`|v0.2.1 |If true, sanitize the HTML passed into `markdownString` with the `sanitizer` function.<br>**Warning**: This feature is deprecated and it should NOT be used as it cannot be considered secure.<br>Instead use a sanitize library, like [DOMPurify](https://github.com/cure53/DOMPurify) (recommended), [sanitize-html](https://github.com/apostrophecms/sanitize-html) or [insane](https://github.com/bevacqua/insane) on the output HTML! |
54
54
|sanitizer |`function`|`null`|v0.3.4 |A function to sanitize the HTML passed into `markdownString`.|
55
55
|silent |`boolean`|`false`|v0.2.7 |If true, the parser does not throw any exception.|
56
56
|smartLists |`boolean`|`false`|v0.2.8 |If true, use smarter list behavior than those found in `markdown.pl`.|
@@ -1536,6 +1536,12 @@ function findClosingBracket(str, b) {
1536
1536
return-1;
1537
1537
}
1538
1538
1539
+
functioncheckSanitizeDeprecation(opt){
1540
+
if(opt&&opt.sanitize&&!opt.silent){
1541
+
console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
1542
+
}
1543
+
}
1544
+
1539
1545
/**
1540
1546
* Marked
1541
1547
*/
@@ -1557,6 +1563,7 @@ function marked(src, opt, callback) {
1557
1563
}
1558
1564
1559
1565
opt=merge({},marked.defaults,opt||{});
1566
+
checkSanitizeDeprecation(opt);
1560
1567
1561
1568
varhighlight=opt.highlight,
1562
1569
tokens,
@@ -1621,6 +1628,7 @@ function marked(src, opt, callback) {
1621
1628
}
1622
1629
try{
1623
1630
if(opt)opt=merge({},marked.defaults,opt);
1631
+
checkSanitizeDeprecation(opt);
1624
1632
returnParser.parse(Lexer.lex(src,opt),opt);
1625
1633
}catch(e){
1626
1634
e.message+='\nPlease report this to https://github.com/markedjs/marked.';
0 commit comments