Skip to content

Commit 74ccecf

Browse files
FHantkeFlorian Hantke
andauthored
chore(docs): add a secure example to the documentation. (#2462)
* Add a sanitized example * Remove ! * move example below warning Co-authored-by: Florian Hantke <florian.hantke@cispa.de>
1 parent 50dbfac commit 74ccecf

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

β€ŽREADME.mdβ€Ž

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,13 @@ Also read about:
4343

4444
## Usage
4545

46-
### 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! 🚨
46+
### 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! 🚨
4747

48-
**CLI**
48+
```
49+
DOMPurify.sanitize(marked.parse(`<img src="x" onerror="alert('not happening')">`));
50+
```
4951

52+
**CLI**
5053

5154
``` bash
5255
# Example with stdin input

β€Ždocs/INDEX.mdβ€Ž

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ These documentation pages are also rendered using marked πŸ’―
2525

2626
<h2 id="usage">Usage</h2>
2727

28-
### Warning: 🚨 Marked does not [sanitize](/using_advanced#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! 🚨
28+
### Warning: 🚨 Marked does not [sanitize](/using_advanced#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! 🚨
29+
30+
```
31+
DOMPurify.sanitize(marked.parse(`<img src="x" onerror="alert('not happening')">`));
32+
```
2933

3034
**CLI**
3135

0 commit comments

Comments
Β (0)