unist utility to inspect nodes.
npm:
npm install unist-util-inspect
var u = require('unist-builder')
var inspect = require('unist-util-inspect')
var tree = u('root', [
u('literal', '1'),
u('parent', [
u('void', {id: 'a'}),
u('literal', '2'),
u('node', {id: 'b'}, [])
])
])
console.log(inspect(tree))
Yields:
root[2]
├─0 literal "1"
└─1 parent[3]
├─0 void
│ id: "a"
├─1 literal "2"
└─2 node[0]
id: "b"
Inspect the given node
.
By default, colors are added in Node, and not in other places.
See below on how to change that.
Whether to include positional information (boolean
, default: true
).
string
— String representing node
.
Where <style>
is either color
or noColor
.
To explicitly add or remove ANSI sequences, use inspect.color(node)
or
inspect.noColor(node)
.
See contributing.md
in syntax-tree/.github
for ways to get
started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.