Gulp task for running markdown-code-blocks.
npm install gulp-markdown-code-blocksGulp task for running markdown-code-blocks.
```
npm install --save-dev gulp gulp-markdown-code-blocks markdown-code-blocks
Evaluating the code of your readme file is as easy as this:
`javascript
'use strict';
var gulp = require('gulp');
var mdBlock = require('gulp-markdown-code-blocks');
gulp.task('default', function () {
return gulp.src('./README.md').pipe(mdBlock());
});
`
Please note that the previous snippet is a code fence, that is evaluated by the code block parser as
well. That means it will try to evaluate require('gulp-markdown-code-blocks'), a.k.a. it will trypackage.json
to resolve the name of this project, which is not part of the file. Before throwingmarkdown-code-blocks
the readme file into , the gulp task try to find your package.json in therequire('name-of-your-package')
same directory as the readme file and replace with require('value-of-the-main-property-of-your-package-json'). So in case of this lib, it will actuallyrequire('./index.js')
be .
The following snippet will be executed and evaluated:
`javascript``
require('assert')(true);
MIT