Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
if (node.children) {
node.children.forEach(preserveInitialSpaces);
}
}
function recreateSpaces (node) {
if (node.type === 'text') {
node.value = node.value.split(spaceToken).join(' ');
}
if (node.children) {
node.children.forEach(recreateSpaces);
}
}
const convert = rehype2remark.apply(this, arguments);
return function (tree, file) {
preserveInitialSpaces(tree);
const markdownTree = convert.apply(this, [tree, file]);
recreateSpaces(markdownTree);
return markdownTree;
}
};