chore: remove old parser
This commit is contained in:
committed by
Mrugesh Mohapatra
parent
e3511f2930
commit
a3a678b7af
15
tools/challenge-parser/parser/plugins/utils/mdast-to-html.js
Normal file
15
tools/challenge-parser/parser/plugins/utils/mdast-to-html.js
Normal 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;
|
Reference in New Issue
Block a user