unist-util-position
unist utility to get the positional info of nodes.
Install
npm:
npm install unist-util-position
Usage
var remark = require('remark')
var position = require('unist-util-position')
var tree = remark().parse('# foo\n\n* bar\n')
position.start(tree) // => {line: 1, column: 1}
position.end(tree) // => {line: 4, column: 1}
position.start() // => {line: null, column: null}
position.end() // => {line: null, column: null}
API
position.start([node])
position.end([node])
Get the start or end points in the positional info of node.
Parameters
node(Node?) — Node to check.
Returns
Point — Filled with line (nullable uint32 >= 1),
column (nullable uint32 >= 1), offset (nullable uint32 >= 0).
Note that in unist, line and column are 1-indexed integers and
offset is a 0-indexed integer.
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, organisation, or community you agree to abide by its terms.