fix(tools): Update createStepFile function in new curriculum helper script (#41693)

* feat: add parseMDSync to parser

* fix: update createStepFile function

Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
This commit is contained in:
Randell Dawson
2021-03-31 09:19:46 -06:00
committed by GitHub
parent 40d7e04a61
commit 5bb773fcec
4 changed files with 88 additions and 49 deletions

View File

@ -53,7 +53,6 @@ exports.parseMD = function parseMD(filename) {
const tree = processor.parse(file);
processor.run(tree, file, function (err, node, file) {
if (!err) {
delete file.contents;
resolve(file.data);
} else {
err.message += ' in file ' + filename;
@ -62,3 +61,15 @@ exports.parseMD = function parseMD(filename) {
});
});
};
exports.parseMDSync = function parseMDSync(filename) {
const file = readSync(filename);
const tree = processor.parse(file);
try {
processor.runSync(tree, file);
} catch (err) {
err.message += ' in file ' + filename;
throw err;
}
return file.data;
};