88[ ![ Backers] [ backers-badge ]] [ collective ]
99[ ![ Chat] [ chat-badge ]] [ chat ]
1010
11- [ Unist ] [ ] node inspector .
11+ [ ** unist ** ] [ unist ] utility to inspect nodes .
1212
13- ## Installation
13+ ## Install
1414
1515[ npm] [ ] :
1616
17- ``` bash
17+ ``` sh
1818npm install unist-util-inspect
1919```
2020
2121## Usage
2222
23- ``` javascript
24- var unified = require (' unified ' )
23+ ``` js
24+ var u = require (' unist-builder ' )
2525var inspect = require (' unist-util-inspect' )
26- var parse = require (' rehype-parse' )
2726
28- var tree = unified ()
29- .use (parse)
30- .parse (' <h2>Hello, world!</h2>' )
27+ var tree = u (' root' , [
28+ u (' literal' , ' 1' ),
29+ u (' parent' , [
30+ u (' void' , {id: ' a' }),
31+ u (' literal' , ' 2' ),
32+ u (' node' , {id: ' b' }, [])
33+ ])
34+ ])
3135
3236console .log (inspect (tree))
3337```
3438
3539Yields:
3640
3741``` text
38- root[1] (1:1-1:23, 0-22) [data={"quirksMode":true} ]
39- └─ element[2] [tagName="html"]
40- ├─ element[0] [tagName="head" ]
41- └─ element[1] [tagName="body "]
42- └─ element[1] (1:1-1:23, 0-22) [tagName="h2"]
43- └─ text: "Hello, world!" (1:5-1:18, 4-17)
42+ root[2 ]
43+ ├─ literal: "1"
44+ └─ parent[3 ]
45+ ├─ void [id="a "]
46+ ├─ literal: "2"
47+ └─ node[0] [id="b"]
4448```
4549
4650## API
@@ -58,7 +62,7 @@ See below on how to change that.
5862
5963` string ` — String representing ` node ` .
6064
61- ### ` inspect.<style>[.<style>... ](node) `
65+ ### ` inspect.<style>[.<style>… ](node) `
6266
6367Where ` <style> ` is either ` color ` or ` noColor ` .
6468
@@ -67,11 +71,13 @@ or `inspect.noColor(node)`.
6771
6872## Contribute
6973
70- See [ ` contributing.md ` in ` syntax-tree/unist ` ] [ contributing ] for ways to get
74+ See [ ` contributing.md ` in ` syntax-tree/.github ` ] [ contributing ] for ways to get
7175started.
76+ See [ ` support.md ` ] [ support ] for ways to get help.
7277
73- This organisation has a [ Code of Conduct] [ coc ] . By interacting with this
74- repository, organisation, or community you agree to abide by its terms.
78+ This project has a [ Code of Conduct] [ coc ] .
79+ By interacting with this repository, organisation, or community you agree to
80+ abide by its terms.
7581
7682## License
7783
@@ -115,6 +121,8 @@ repository, organisation, or community you agree to abide by its terms.
115121
116122[ author ] : https://wooorm.com
117123
118- [ contributing ] : https://github.com/syntax-tree/unist /blob/master/contributing.md
124+ [ contributing ] : https://github.com/syntax-tree/.github /blob/master/contributing.md
119125
120- [ coc ] : https://github.com/syntax-tree/unist/blob/master/code-of-conduct.md
126+ [ support ] : https://github.com/syntax-tree/.github/blob/master/support.md
127+
128+ [ coc ] : https://github.com/syntax-tree/.github/blob/master/code-of-conduct.md
0 commit comments