0.4.4 • Published 3 years ago

mddata v0.4.4

Weekly downloads
3
License
MIT
Repository
github
Last release
3 years ago

MdData

npm package dependency status build status

extracting hierarchic data from Markdown documents

Application

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.

Interface

MdData makes use of GulpText simple to provide the API. Therefore, it currently supports three ways of usage.

  1. Use the readFileSync(path) function, to get the extracted data of a Markdown file.
  2. Specify a Markdown string, to get the extracted data.
  3. Give no arguments, to get a gulp transformation.

Transform a file directly

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');

Transform a string

Give a Markdown string to extract the hierarchic data.

var mddata = require('mddata');
var documentPath = 'project_a/docs/index.md';
var result = mdinclude('# Introduction ...');

Create a Gulp transformation

var mddata = require('mddata');
var gulp = require('gulp');

gulp.task('preprocess-markdown', function() {
    return gulp.src('docs/*.md')
        .pipe(mddata())
        .pipe(gulp.dest('out'));
});

License

MdData is published under the MIT license.

0.4.4

3 years ago

0.4.3

3 years ago

0.4.2

6 years ago

0.4.1

7 years ago

0.4.0

8 years ago

0.3.0

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago