Unist utility to get the source of a Node or Location.
npm:
npm install unist-util-source
var remark = require('remark');
var source = require('./');
remark()
.use(function () {
return transformer;
function transformer(tree, file) {
var list = tree.children[0].children[0];
console.log(source(list, file));
}
})
.process('> + **[Hello](./example)**\n> world.');
Yields:
+ **[Hello](./example)**
world.
string?
— Source of value
in file
, if available.