Closed benbenbenbenbenben closed 4 years ago
Okay, perhaps to answer my own question - I wrote a basic plugin inline that did what I needed.
I could then pickout the position data form the data
property of the node.
If anyone else needs this:
const visit = require(`unist-util-visit`)
///
const bem = filename => require(`md-to-bemjson`).convertSync(require(`fs`).readFileSync(filename), {
plugins: [
{
plugin: () => (tree, file) => {
visit(tree, node => {
node.data = {
start: node.position.start,
end: node.position.end
}
})
}, options: {}
}
]
})
I'm experimenting with this project to compile markdown as part of a documentation-driven development project I'm working on.
Is it possible (easy?) to get position information in the output of
convert
?