File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change 1
1
# hast-util-sanitize [ ![ Build Status] [ travis-badge ]] [ travis ] [ ![ Coverage Status] [ codecov-badge ]] [ codecov ]
2
2
3
- <!-- lint disable heading-increment list-item-spacing-->
4
-
5
3
Sanitize [ HAST] [ ] .
6
4
7
5
## Installation
8
6
9
- [ npm] [ npm-install ] :
7
+ [ npm] [ ] :
10
8
11
9
``` bash
12
10
npm install hast-util-sanitize
13
11
```
14
12
15
13
## Usage
16
14
17
- Dependencies:
18
-
19
15
``` javascript
20
16
var h = require (' hastscript' );
21
17
var u = require (' unist-builder' );
22
18
var sanitize = require (' hast-util-sanitize' );
23
19
var toHTML = require (' hast-util-to-html' );
24
- ```
25
-
26
- Transform:
27
20
28
- ``` javascript
29
21
var tree = h (' div' , {
30
22
onmouseover: ' alert("alpha")'
31
23
}, [
@@ -44,11 +36,7 @@ var tree = h('div', {
44
36
' xlink:href' : ' data:x,<script>alert("foxtrot")</script>'
45
37
}))
46
38
]);
47
- ```
48
39
49
- Compile:
50
-
51
- ``` javascript
52
40
var unsanitized = toHTML (tree);
53
41
var sanitized = toHTML (sanitize (tree));
54
42
```
@@ -239,7 +227,7 @@ should however be entirely stripped from the tree.
239
227
240
228
[ codecov ] : https://codecov.io/github/wooorm/hast-util-sanitize
241
229
242
- [ npm-install ] : https://docs.npmjs.com/cli/install
230
+ [ npm ] : https://docs.npmjs.com/cli/install
243
231
244
232
[ license ] : LICENSE
245
233
You can’t perform that action at this time.
0 commit comments