extracting hierarchic data from Markdown documents
MdData parses a Markdown document and extracts a hierarchic data structure, which represents headlines and lists.
Take a look at the test document and the result.
It can be used as a function or with Gulp.
MdData makes use of GulpText simple to provide the API. Therefore, it currently supports three ways of usage.
- Use the
readFileSync(path)function, to get the extracted data of a Markdown file. - Specify a Markdown string, to get the extracted data.
- Give no arguments, to get a gulp transformation.
Use the function readFileSync(path) and specify a path to the Markdown file.
var mddata = require('mddata');
var result = mddata.readFileSync('project_a/docs/index.md');Give a Markdown string to extract the hierarchic data.
var mddata = require('mddata');
var documentPath = 'project_a/docs/index.md';
var result = mdinclude('# Introduction ...');var mddata = require('mddata');
var gulp = require('gulp');
gulp.task('preprocess-markdown', function() {
return gulp.src('docs/*.md')
.pipe(mddata())
.pipe(gulp.dest('out'));
});MdData is published under the MIT license.