feat: tie in challenge parser

This commit is contained in:
Mrugesh Mohapatra
2018-09-27 20:21:53 +05:30
parent 03abb0facc
commit eff9ce74bd
19 changed files with 1100 additions and 1099 deletions

View File

@ -0,0 +1,23 @@
const visit = require('unist-util-visit');
const YAML = require('js-yaml');
function plugin() {
return transformer;
function transformer(tree, file) {
visit(tree, 'code', visitor);
function visitor(node) {
const { lang, value } = node;
if (lang === 'yml') {
const tests = YAML.load(value);
file.data = {
...file.data,
...tests
};
}
}
}
}
module.exports = plugin;