# mdx-to-md

> Convert MDX to Markdown.

Latest version **0.5.2** (published 2025-04-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install mdx-to-md
pnpm add mdx-to-md
yarn add mdx-to-md
bun add mdx-to-md
```

Provides the command `mdx-to-md`.

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2025-04-08 |
| First published | 2022-04-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 7 |
| Unpacked size | 5.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 60 |
| Author | Travis Arnold |
| Maintainers | souporserious |
| Keywords | markdown, md, mdx, jsx |

## Links

- npm: https://www.npmjs.com/package/mdx-to-md
- Repository: https://github.com/souporserious/mdx-to-md
- Homepage: https://github.com/souporserious/mdx-to-md#readme
- Issues: https://github.com/souporserious/mdx-to-md/issues
- npm.io page: https://npm.io/package/mdx-to-md

## Dependencies (7)

- [react](https://npm.io/package/react.md) ^19.1.0
- [chokidar](https://npm.io/package/chokidar.md) ^4.0.3
- [react-dom](https://npm.io/package/react-dom.md) ^19.1.0
- [args-flags](https://npm.io/package/args-flags.md) ^1.1.1
- [@mdx-js/mdx](https://npm.io/package/@mdx-js/mdx.md) ^3.1.0
- [mdx-bundler](https://npm.io/package/mdx-bundler.md) ^10.1.1
- [node-html-markdown](https://npm.io/package/node-html-markdown.md) ^1.3.0

## Alternatives

- [@mdxeditor/editor](https://npm.io/package/@mdxeditor/editor.md) — 962.4K weekly downloads
- [mmdb-lib](https://npm.io/package/mmdb-lib.md) — 680.9K weekly downloads
- [playcanvas](https://npm.io/package/playcanvas.md) — 36.2K weekly downloads
- [@glw907/cairn-cms](https://npm.io/package/@glw907/cairn-cms.md) — 967 weekly downloads
- [markdown-to-confluence](https://npm.io/package/markdown-to-confluence.md) — 103 weekly downloads

## Recent versions

- 0.5.2 (latest) — 2025-04-08
- 0.4.0 — 2025-04-07
- 0.3.2 — 2023-05-25
- 0.3.1 — 2022-04-27
- 0.3.0 — 2022-04-23
- 0.2.1 — 2022-04-23
- 0.2.0 — 2022-04-23
- 0.1.0 — 2022-04-22

## README

<!--- This markdown file was auto-generated from "src/README.mdx" -->

# mdx-to-md

Convert MDX to Markdown. 

## Why?

This library is most useful for generating README.md files [like the one you're reading](/src/README.mdx).

# Install

```bash
pnpm add mdx-to-md
```

```bash
npm install mdx-to-md
```

## CLI

```bash
mdx-to-md [sourcePath] [outPath]

```

In the simplest use case, you can run the CLI and it will output the converted Markdown relative to the current working directory the script was run in:

```bash
pnpm mdx-to-md README.mdx

```

## Node

Start with MDX:

```mdx
import { name, description } from "./package.json"

# {name}

{description}

# Install

<pre>
  <code className="language-bash">pnpm add {name}</code>
</pre>

```

And convert it to Markdown:

```ts
import { writeFile } from "node:fs/promises"
import { resolve } from "node:path"
import { mdxToMd } from "mdx-to-md"

const mdxPath = resolve(process.cwd(), "README.mdx")
const markdown = await mdxToMd(mdxPath)
const banner = `This README was auto-generated using "pnpm build:readme"`
const readme = `<!--- ${banner} --> \n\n ${markdown}`

await writeFile("README.md", readme)

console.log("📝 Converted README.mdx -> README.md")

```

Which outputs:

```md
# mdx-to-md

Convert MDX to Markdown.

# Install

pnpm add mdx-to-md

```

---
_Source: https://npm.io/package/mdx-to-md · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
