All Projects → syntax-tree → unist-util-inspect

syntax-tree / unist-util-inspect

Licence: MIT License
utility to inspect nodes

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to unist-util-inspect

unist-util-visit-parents
utility to recursively walk over unist nodes, with ancestral information
Stars: ✭ 25 (+56.25%)
Mutual labels:  syntax-tree, util, unist, unist-util
unist-builder
utility to create a new trees with a nice syntax
Stars: ✭ 52 (+225%)
Mutual labels:  syntax-tree, util, unist, unist-util
unist-util-map
utility to create a new tree by mapping all nodes
Stars: ✭ 30 (+87.5%)
Mutual labels:  syntax-tree, util, unist, unist-util
mdast-util-to-string
utility to get the plain text content of an mdast node
Stars: ✭ 27 (+68.75%)
Mutual labels:  syntax-tree, util, unist
hast-util-to-html
utility to serialize hast to HTML
Stars: ✭ 47 (+193.75%)
Mutual labels:  syntax-tree, util, unist
hast-util-from-dom
utility to transform a DOM tree to hast
Stars: ✭ 20 (+25%)
Mutual labels:  syntax-tree, util, unist
nlcst-to-string
utility to transform an nlcst tree to a string
Stars: ✭ 16 (+0%)
Mutual labels:  syntax-tree, util, unist
unist-util-select
utility to select unist nodes with CSS-like selectors
Stars: ✭ 41 (+156.25%)
Mutual labels:  util, unist, unist-util
hast-util-sanitize
utility to sanitize hast nodes
Stars: ✭ 34 (+112.5%)
Mutual labels:  syntax-tree, util, unist
xast
Extensible Abstract Syntax Tree
Stars: ✭ 32 (+100%)
Mutual labels:  syntax-tree, unist
ntast
Notion Abstract Syntax Tree specification.
Stars: ✭ 101 (+531.25%)
Mutual labels:  syntax-tree, unist
mdast-util-to-hast
utility to transform mdast to hast
Stars: ✭ 53 (+231.25%)
Mutual labels:  syntax-tree, unist
Unified
☔️ interface for parsing, inspecting, transforming, and serializing content through syntax trees
Stars: ✭ 3,036 (+18875%)
Mutual labels:  syntax-tree, unist
Unist Util Visit
utility to visit nodes
Stars: ✭ 101 (+531.25%)
Mutual labels:  syntax-tree, util
sast
Parse CSS, Sass, SCSS, and Less into a unist syntax tree
Stars: ✭ 51 (+218.75%)
Mutual labels:  syntax-tree, unist
hast-util-to-mdast
utility to transform hast (HTML) to mdast (markdown)
Stars: ✭ 26 (+62.5%)
Mutual labels:  unist, unist-util
MarkdownSyntax
☄️ A Type-safe Markdown parser in Swift.
Stars: ✭ 65 (+306.25%)
Mutual labels:  syntax-tree, unist
er-console
随机打印恶搞信息
Stars: ✭ 24 (+50%)
Mutual labels:  console
webinc
Webex in console - Cisco Webex Teams Client for Linux/MacOS/Windows
Stars: ✭ 17 (+6.25%)
Mutual labels:  console
color-console
A lightweight header-only C++ library to bring colors to your Windows console with a very-easy-to-use API.
Stars: ✭ 97 (+506.25%)
Mutual labels:  console

unist-util-inspect

Build Coverage Downloads Size Sponsors Backers Chat

unist utility to inspect nodes.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install unist-util-inspect

Use

import {u} from 'unist-builder'
import {inspect} from 'unist-util-inspect'

const 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"

API

This package exports the following identifiers: inspect, inspectColor, and inspectNoColor. There is no default export.

inspect(node[, options])

Inspect the given node. By default, colors are added in Node, and not in other places. See below on how to change that.

options.showPositions

Whether to include positional information (boolean, default: true).

Returns

string — String representing node.

inspectColor(node[, options])

Inspect, with ANSI color sequences (default in Node).

inspectNoColor(node[, options])

Inspect, but without ANSI color sequences (default in browser).

Contribute

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.

License

MIT © Titus Wormer

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].