# @zeit/next-mdx

> Use [MDX](https://github.com/mdx-js/mdx) with [Next.js](https://github.com/zeit/next.js)

Latest version **1.2.0** (published 2018-09-19) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @zeit/next-mdx
pnpm add @zeit/next-mdx
yarn add @zeit/next-mdx
bun add @zeit/next-mdx
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2018-09-19 |
| First published | 2018-02-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 3.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2667 |
| Maintainers | arunoda, codetheory, hharnisc, iamevilrabbit, igorklopov, jamo, javivelasco, joecohens, leo, matheuss, nkzawa, olliv, rauchg, timneutkens, tootallnate |

## Links

- npm: https://www.npmjs.com/package/@zeit/next-mdx
- Repository: https://github.com/zeit/next-plugins
- Homepage: https://github.com/zeit/next-plugins#readme
- Issues: https://github.com/zeit/next-plugins/issues
- npm.io page: https://npm.io/package/@zeit/next-mdx

## Dependencies (1)

- [@mdx-js/loader](https://npm.io/package/@mdx-js/loader.md) ^0.15.0

## Recent versions

- 1.2.0 (latest) — 2018-09-19
- 1.1.1-canary.4 (canary) — 2019-02-25
- 1.1.1-canary.3 — 2018-12-07
- 1.2.1-canary.0 — 2018-11-14
- 1.1.1-canary.2 — 2018-08-18
- 1.1.1-canary.1 — 2018-07-30
- 1.1.0 — 2018-05-17
- 1.0.0 — 2018-04-18
- 0.0.2 — 2018-02-11
- 0.0.1 — 2018-02-11

## README

# Next.js + MDX

Use [MDX](https://github.com/mdx-js/mdx) with [Next.js](https://github.com/zeit/next.js)

## Installation

```
npm install --save @zeit/next-mdx @mdx-js/mdx
```

or

```
yarn add @zeit/next-mdx @mdx-js/mdx
```

## Usage

Create a `next.config.js` in your project

```js
// next.config.js
const withMDX = require('@zeit/next-mdx')()
module.exports = withMDX()
```

Optionally you can provide [MDX options](https://github.com/mdx-js/mdx#options):

```js
// next.config.js
const withMDX = require('@zeit/next-mdx')({
  options: {
    mdPlugins: [

    ],
    hastPlugins: [

    ]
  }
})
module.exports = withMDX()
```

Optionally you can add your custom Next.js configuration as parameter

```js
// next.config.js
const withMDX = require('@zeit/next-mdx')()
module.exports = withMDX({
  webpack(config, options) {
    return config
  }
})
```

Optionally you can match other file extensions for MDX compilation, by default only `.mdx` is supported

```js
// next.config.js
const withMDX = require('@zeit/next-mdx')({
  extension: /\.mdx?$/
})
module.exports = withMDX()
```

## Top level .mdx pages

Define the `pagesExtensions` option to have Next.js handle `.mdx` files in the `pages` directory as pages:

```js
// next.config.js
const withMDX = require('@zeit/next-mdx')({
  extension: /\.mdx?$/
})
module.exports = withMDX({
  pageExtensions: ['js', 'jsx', 'mdx']
})
```

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