Feat: add new Markdown parser (#39800)

and change all the challenges to new `md` format.
This commit is contained in:
Oliver Eyton-Williams
2020-11-27 19:02:05 +01:00
committed by GitHub
parent a07f84c8ec
commit 0bd52f8bd1
2580 changed files with 113436 additions and 111979 deletions

View File

@@ -0,0 +1,15 @@
const hastToHTML = require('hast-util-to-html');
const mdastToHast = require('mdast-util-to-hast');
const { root } = require('mdast-builder');
function mdastToHTML(nodes) {
if (!Array.isArray(nodes))
throw Error('mdastToHTML expects an array argument');
// - the 'nodes' are children, so first need embedding in a parent
return hastToHTML(mdastToHast(root(nodes), { allowDangerousHtml: true }), {
allowDangerousHtml: true
});
}
module.exports = mdastToHTML;