Closed tomgenoni closed 8 years ago
Apologies for the super belated response. For the one year anniversary (!) of your question I added an optional transform function (#14) that passes the Vinyl object which provides this property. This approach (vs. config) has been super helpful for me in other plugins where I've had similar needs.
To add it to the JSON output:
gulp.src('./content/**/*.md')
.pipe(gutil.buffer())
.pipe(markdownToJSON(marked, (data, file) => {
data.path = file.path;
return data;
}))
.pipe(gulp.dest('.'))
This was published as 1.0.0, closing for now, feel free to reopen if you've got any feedback
Thanks for the script. This is great. Had one question: in addition to the front-matter content I wanted to pass in the path to the file —
file.path
— so that with each entry in the resulting json there'd be a "path":"/path/to/file.md". Is that possible?