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.
This package is ESM only:
Node 12+ is needed to use it and it must be import
ed instead of require
d.
npm:
npm install remark-strip-mdx
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.