Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const parse = (src, options) => {
const inlineModules = [];
const { data, content } = matter(src);
const separatedContent = normalizeNewline(content)
/*
* Set aside all inline JSX import and export statements from the MDX file.
* When mdx.sync() compiles MDX into JSX, it will stub any component that doesn't
* have a corresponding import. Therefore, we will re-add all of the imports/exports
* to each slide before compiling the MDX via mdx.sync().
*/
.replace(MOD_REG, (value, group1) => {
if (!group1) {
// group1 is empty, so this is not the import/export case we're looking for
return value;
} else {
// found an inline export or import statement
inlineModules.push(value);
return '';
}
})
const consoleOutput = () => output.mock.calls.map(args => normalizeNewline(args[0]));
const consoleOutput = () => output.mock.calls.map(args => normalizeNewline(args[0]));
const consoleOutput = () => output.mock.calls.map(args => normalizeNewline(args[0]));
afterEachRender (opts) {
if (normalizeNewline(opts.newMD) !== normalizeNewline(opts.currentMD)) {
fs.writeFileSync(opts.filePath, opts.newMD, {
encoding: 'utf8',
})
const relativePath = normalizePath(getRelativePath(opts.filePath))
console.log('updated', highlightPath(relativePath))
}
},
})
afterEachRender (opts) {
const relativePath = normalizePath(getRelativePath(opts.filePath))
t.equal(normalizeNewline(opts.newMD), normalizeNewline(opts.currentMD), relativePath)
},
})