feat: add a markdown parser for challenges

This commit is contained in:
Mrugesh Mohapatra
2018-09-27 16:00:11 +05:30
parent 77d057d4e5
commit f022177352
15 changed files with 8620 additions and 0 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;