Releases: hashicorp/next-mdx-remote
v5.0.0
v4.4.1
What's Changed
- chore(types): remove unused imports by @thiskevinwang in #348
- fix: Make sure frontmatter types flow through to MDXRemote by @brkalow in #351
Full Changelog: v4.4.0...v4.4.1
v4.4.0
This release includes a few fixes for frontmatter types, as well as a way to provide a frontmatter type to serialize or compileMDX and have it propagate through to the returned frontmatter property. See the documentation for an example.
serialize:
import { serialize } from 'next-mdx-remote/serialize'
interface Frontmatter {
title: string
published: string
description?: string
}
// π should have type Frontmatter
const { frontmatter } = serialize<Record<string, unknown>, Frontmatter>(source)compileMDX:
import { compileMDX } from 'next-mdx-remote/rsc'
interface Frontmatter {
title: string
published: string
description?: string
}
export default async function Page({ source }) {
// π should have type Frontmatter
const { content, frontmatter } = await compileMDX<Frontmatter>(source)
return (
<>
<h1>{frontmatter.title}</h1>
{content}
</>
)
}What's Changed
- docs: fix react server components example by @Greyhere in #334
- fix(rsc): do not require compiledSource in types by @brkalow in #339
- fix: TFrontmatter type to unknown by @RebootGG in #340
- remove newline from template literal by @chrisweb in #346
- feat: Improve frontmatter types, pass generic TFrontmatter type through by @brkalow in #342
New Contributors
- @Greyhere made their first contribution in #334
- @RebootGG made their first contribution in #340
- @chrisweb made their first contribution in #346
Full Changelog: v4.3.0...v4.4.0
v4.3.0 - Server Components Support (experimental)
next-mdx-remote now has experimental support for React Server Components! π Access the new API by importing from next-mdx-remote/rsc, and head to the documentation for usage instructions and additional examples.
import { MDXRemote } from 'next-mdx-remote/rsc'
export default async function Page() {
const mdxSource = await getContent()
return (
<MDXRemote source={mdxSource} />
)
}Big thanks to @timneutkens for his contribution!
What's Changed
- Pass components directly to compiled MDX function by @timneutkens in #330
- Add support for React Server Components by @timneutkens in #331
- chore: run tests in isolation by @brkalow in #332
- chore: document new RSC API by @brkalow in #333
New Contributors
- @timneutkens made their first contribution in #330
Full Changelog: v4.2.1...v4.3.0
v4.2.1
v4.2.0
What's Changed
- Support serializing all VFile-compatible values by @nwalters512 in #311
New Contributors
- @nwalters512 made their first contribution in #311
Full Changelog: v4.1.0...v4.2.0
v4.1.0
What's Changed
- chore: update reference to MDX options by @brkalow in #280
- fix: loosen
frontmattertype and make it configurable by @joemckenney in #283
New Contributors
- @joemckenney made their first contribution in #283
Full Changelog: v4.0.3...v4.1.0
v4.0.3
What's Changed
- Improved typing of the
frontmatterprop. by @MatthijsMud in #252 - fix: support both react 17 and react 18 jsx-runtime imports by @brkalow in #267
New Contributors
- @MatthijsMud made their first contribution in #252
Full Changelog: v4.0.2...v4.0.3
v4.0.1
What's Changed
- fix: Can't resolve 'react/jsx-runtime.js' by @jakejarvis in #250
New Contributors
- @jakejarvis made their first contribution in #250
Full Changelog: v4.0.0...4.0.1
v4.0.0
next-mdx-remote has been upgraded to use MDX v2 under the hood, which comes with improved performance and a whole list of other enhancements. Due to the improved code generated from MDX, we've also been able to remove our usage of esbuild. If you're using Next v12, no changes should be required to upgrade! Users on Next v11.1 might need to set experimental: { esmExternals: true } in next.config.js.
Note that some of the underlying changes in MDX v2 may require you to adjust some of your MDX content or custom components.
Take it for a spin and let us know if you run into any issues. π
$ npm install next-mdx-remote@latest
Breaking Changes
- Exposes ESM
- Upgrade to MDX v2 under the hood, see the blog post for more information
- Remove esbuild integration
Features
- Optional frontmatter parsing by passing
{ parseFrontmatter: true }toserialize(). Frontmatter is then available in your MDX:# {frontmatter.page_title} Hello world! - Improved error messages when MDX fails to compile:

Full Changelog: 3.0.7...v4.0.0