1.0.2 • Published 8 months ago

remark-strip-mdx v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

remark-strip-mdx

This is a fork of the strip-markdown package, but for MDX.

remark plugin to remove MDX formatting. This essentially removes everything but paragraphs and text nodes.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install remark-strip-mdx

Use

import { remark } from 'remark'
import remarkMdx from 'remark-mdx'
import strip from 'remark-strip-mdx'

remark()
  .use(remarkMdx)
  .use(strip)
  .process('import Sample from "./sample";\n\nSome _emphasis_, **importance**, and `code`.\n\n<Sample />')
  .then((file) => {
    console.log(String(file))
  })

Yields:

Some emphasis, importance, and code.