Skip to content

Commit

Permalink
chore(docs): add a secure example to the documentation. (#2462)
Browse files Browse the repository at this point in the history
* Add a sanitized example

* Remove !

* move example below warning

Co-authored-by: Florian Hantke <florian.hantke@cispa.de>
  • Loading branch information
FHantke and Florian Hantke committed May 7, 2022
1 parent 50dbfac commit 74ccecf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -43,10 +43,13 @@ Also read about:

## Usage

### 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! 🚨
### 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! 🚨

**CLI**
```
DOMPurify.sanitize(marked.parse(`<img src="x" onerror="alert('not happening')">`));
```

**CLI**

``` bash
# Example with stdin input
Expand Down
6 changes: 5 additions & 1 deletion docs/INDEX.md
Expand Up @@ -25,7 +25,11 @@ These documentation pages are also rendered using marked πŸ’―

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

### 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! 🚨
### 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! 🚨

```
DOMPurify.sanitize(marked.parse(`<img src="x" onerror="alert('not happening')">`));
```

**CLI**

Expand Down

1 comment on commit 74ccecf

@vercel
Copy link

@vercel vercel bot commented on 74ccecf May 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

marked-website – ./

markedjs.vercel.app
marked.js.org
marked-website-git-master-markedjs.vercel.app
marked-website-markedjs.vercel.app

Please sign in to comment.