remark-mdx-remove-exports

Remove exports from the MDX AST

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
remark-mdx-remove-exports
16,781151.6.223 years ago5 years agoMinified + gzip package size for remark-mdx-remove-exports in KB

Readme

remark-mdx-remove-exports
!Build Statusbuild-badgebuild !lernalerna-badgelerna !Chatchat-badgechat
Remove export nodes from the MDXAST. This is useful for scenarios where the exports aren’t needed like an MDX playground.

Installation

npm install --save remark-mdx-remove-exports
## Usage

Say we have the following MDX file, `example.mdx`:

```markdown
import { Donut } from 'rebass'

import OtherThing from 'other-place'

export default props => <div {...props} />

# Hello, world!

This is a paragraph

And our script, example.js, looks as follows:
const vfile = require('to-vfile')
const remark = require('remark')
const mdx = require('remark-mdx')
const removeExports = require('remark-mdx-remove-exports')

remark()
  .use(mdx)
  .use(removeExports)
  .process(vfile.readSync('example.md'), function (err, file) {
    if (err) throw err
    console.log(String(file))
  })

Now, running node example yields:
import { Donut } from 'rebass'

import OtherThing from 'other-place'

# Hello, world!

This is a paragraph

Contribute

See the Support and Contributing guidelines on the MDX website for ways to (get) help.
This project has a Code of Conductcoc. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © John Otanderjohno