Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import compileModule from '../../../utils/compileModule';
import pkg from '@mdx-js/mdx/package.json';
const ID = 'mdx';
export default {
id: ID,
displayName: ID,
version: pkg.version,
homepage: 'https://mdxjs.com',
defaultParserID: 'mdxhast',
loadTransformer(callback) {
require([
'../../../transpilers/babel',
'@mdx-js/mdx',
'prettier/standalone',
'prettier/parser-babylon',
], (transpile, mdx, prettier, babylon) => {
callback({ transpile: transpile.default, mdx, prettier, babylon });
});
},
transform({ transpile, mdx, prettier, babylon }, transformCode, code) {
css={css({
mr: 3
})}
/>
<div>
<span>
v{pkg.version}
</span>
<a href="https://github.com/mdx-js/mdx">
<img alt="GitHub logo" src="{`https://icon.now.sh/github/24/${dark">
</a>
</div>
const ID = 'mdxhast';
function removeNewlines(node) {
if (node.children != null) {
node.children = node.children.filter(node => node.value !== '\n');
node.children.forEach(removeNewlines);
}
}
export default {
...defaultParserInterface,
id: ID,
displayName: ID,
version: pkg.version,
homepage: 'https://mdxjs.com',
locationProps: new Set(['position']),
loadParser(callback) {
require(['@mdx-js/mdx', '@mdx-js/mdx/mdx-ast-to-mdx-hast'], callback);
},
parse([mdx, mdxAstToMdxHast], code) {
let result;
mdx.sync(code, {
hastPlugins: [
mdxAstToMdxHast,
() => removeNewlines,
() => tree => {
result = tree;
},