Bot releases are visible (Hide)
Published by BRKalow over 1 year ago
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.4.0...v4.4.1
Published by BRKalow over 1 year ago
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}
</>
)
}
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.3.0...v4.4.0
Published by BRKalow over 1 year ago
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!
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.2.1...v4.3.0
Published by BRKalow almost 2 years ago
jsx-dev-runtime
in development mode by @imtsuki in https://github.com/hashicorp/next-mdx-remote/pull/323
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.2.0...v4.2.1
Published by BRKalow almost 2 years ago
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.1.0...v4.2.0
Published by BRKalow about 2 years ago
frontmatter
type and make it configurable by @joemckenney in https://github.com/hashicorp/next-mdx-remote/pull/283
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.0.3...v4.1.0
Published by BRKalow over 2 years ago
frontmatter
prop. by @MatthijsMud in https://github.com/hashicorp/next-mdx-remote/pull/252
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.0.2...v4.0.3
Published by BRKalow over 2 years ago
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/v4.0.0...4.0.1
Published by BRKalow over 2 years ago
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
{ parseFrontmatter: true }
to serialize()
. Frontmatter is then available in your MDX:
# {frontmatter.page_title}
Hello world!
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/3.0.7...v4.0.0
Published by BRKalow almost 3 years ago
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@next
{ parseFrontmatter: true }
to serialize()
. Frontmatter is then available in your MDX:
# {frontmatter.page_title}
Hello world!
Full Changelog: https://github.com/hashicorp/next-mdx-remote/compare/3.0.7...v4.0.0-rc.1
Patches a small bug with remark options (https://github.com/hashicorp/next-mdx-remote/pull/206), big thanks to @matthewoates for the contribution!
Published by BRKalow about 3 years ago
requestIdleCallback
to match the definition from TS 4.4 (https://github.com/hashicorp/next-mdx-remote/pull/191)Thanks to @jkjustjoshing for the contribution! ✨
Published by BRKalow over 3 years ago
next-mdx-remote
in yarn workspaces (#145)Thanks to @younes200 for the documentation fix!
Published by BRKalow over 3 years ago
⚠️ This is a BREAKING RELEASE and will require manual changes ⚠️
This release includes a full rewrite of the internals of next-mdx-remote
to make it faster, lighter-weight, and behave more predictably! The migration should be fairly quick for most use-cases, but it will require some manual changes. Thanks to our community for testing out this release and providing early feedback. ❤️
renderToString
has been replaced with serialize
hydrate
has been replaced with <MDXRemote />
As of v3, usage of next-mdx-remote
is slightly different. renderToString
has been replaced with serialize
, and hydrate
has been removed in favor of the <MDXRemote />
component.
Under the hood, v3 is more efficient and we've fixed a number of long-standing caveats with the way it was implemented. Most users should notice improved performance across the board!
First step:
// npm
npm install next-mdx-remote@latest
// yarn
yarn add next-mdx-remote@latest
Here's what the diff looks like to migrate a simple implementation:
- import renderToString from 'next-mdx-remote/render-to-string'
+ import { serialize } from 'next-mdx-remote/serialize'
- import hydrate from 'next-mdx-remote/hydrate'
+ import { MDXRemote } from 'next-mdx-remote'
import Test from '../components/test'
const components = { Test }
export default function TestPage({ source }) {
- const content = hydrate(source, { components })
return (
<div className="wrapper">
- {content}
+ <MDXRemote {...source} components={components} />
</div>
)
}
export async function getStaticProps() {
// MDX text - can be from a local file, database, anywhere
const source = 'Some **mdx** text, with a component <Test />'
- const mdxSource = await renderToString(source, { components })
+ const mdxSource = await serialize(source)
return { props: { source: mdxSource } }
}
Context usage and providers will now work without any additional configuration. Any contexts which are rendered higher up in the tree should be available for use within your rendered MDX. This should also fix a number of SSR-related CSS-in-JS bugs users were experiencing.
By default, <MDXRemote />
will now hydrate immediately. If you wish to retain the lazy hydration behavior, pass the lazy
prop:
<MDXRemote {...source} lazy />
Previously, the peer dependency range for this library was very tight and cut off at react 17.0.1
, so you'd get errors with the most recent react version. Now, it's a lot looser and will accept anything between react v16 and v18. Apologies for the annoyance!
This release also comes with a number of wonderful additions to the documentation, thanks to those who contributed!
Huge thanks to @eric-burel for helping!