Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

remark-mdx-remove-imports

Package Overview
Dependencies
Maintainers
4
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remark-mdx-remove-imports

Remove imports from the MDX AST

  • 1.6.21
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4.4K
decreased by-28.59%
Maintainers
4
Weekly downloads
 
Created
Source

remark-mdx-remove-imports

Build Status lerna Chat

Remove import nodes from the MDXAST. This is useful for scenarios where the imports aren’t needed like an MDX playground.

Installation

npm:

npm install --save remark-mdx-remove-imports

Usage

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

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 removeImports = require('remark-mdx-remove-imports')

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

Now, running node example yields:

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

# 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 Conduct. By interacting with this repository, organisation, or community you agree to abide by its terms.

License

MIT © John Otander

Keywords

FAQs

Package last updated on 07 Nov 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc