Skip to content

Replace next-mdx-remote with @mdx-js/mdx - #48

Merged
negz merged 1 commit into
modelplaneai:mainfrom
jbw976:drop-next-mdx-remote
Oct 30, 2026
Merged

negz merged 1 commit into
modelplaneai:mainfrom
jbw976:drop-next-mdx-remote

Conversation

@jbw976

@jbw976 jbw976 commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

What and why

Blog posts are currently compiled and rendered with next-mdx-remote, which is licensed under MPL-2.0 and has actually been archived upstream. It's just a thin wrapper around @mdx-js/mdx, which is MIT licensed, maintained, and already in our dependency tree.

This commit now just uses @mdx-js/mdx directly, with the same plugins and options, so every blog post renders the same HTML as it did before. We drop the problematic next-mdx-remote dependency completely.

This makes our website licensing story better - it would be hard to ask for an MPL exception for a dependency that is archived/unsupported 😅

Note that next-mdx-remote also stripped JavaScript out of posts by default. None of our posts uses JavaScript, and I don't see why we'd need to, so we do not reimplement that functionality here.

The scope of these changes would only affect how we compile blog posts from their source tree mdx format into HTML live on the site. I built the site locally and had an agent compare all the blog posts HTML from the local site versus the production site and they resulted in the same HTML. I also poked around through the rendered blog posts on my local site, clicked the links, checked the formatting, etc. and things look OK to my human eyes also 👀

I'll do the same on the Vercel preview when it's ready.

I am not a typescript expert but i did walk through all these code changes and think about them to understand them myself - I didn't see anything unreasonable here IMO.

Checklist

  • Ran npm run lint and npm run build locally.
  • Ran npm run validate-posts if I changed blog content.
  • Signed off my commits with git commit -s.

Blog posts are currently compiled and rendered with next-mdx-remote, which is
licensed under MPL-2.0 and has actually been archived upstream. It's just a thin
wrapper around @mdx-js/mdx, which is MIT licensed, maintained, and already in our
dependency tree.

This commit now just uses @mdx-js/mdx directly, with the same plugins and
options, so every blog post renders the same HTML as it did before. We drop
the problematic next-mdx-remote dependency completely.

Note that next-mdx-remote also stripped JavaScript out of posts by default. None
of our posts uses JavaScript, and I don't see why we'd need to, so we do not
reimplement that functionality here.

Signed-off-by: Jared Watts <jbw976@gmail.com>
Comment thread pages/blog/[slug].tsx
Comment on lines -200 to -221
remarkPlugins: [remarkGfm],
rehypePlugins: [
// Lift standalone images out of their wrapping <p> so our <figure>/<figcaption>
// image renderer doesn't produce invalid <p><figure> nesting (a hydration error).
rehypeUnwrapImages,
rehypeSlug,
[
rehypeAutolinkHeadings,
{
behavior: 'append',
properties: { className: ['heading-anchor'], ariaHidden: true, tabIndex: -1 },
content: { type: 'text', value: '#' },
},
],
[
rehypePrettyCode,
{
theme: 'github-dark',
// Let our CSS own the background so code blocks match the deep-space theme.
keepBackground: false,
},
],

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all these options are basically the same, their indentation just changed

@negz
negz merged commit 1d203ce into modelplaneai:main Oct 30, 2026
2 checks passed

This branch was successfully deployed

1 active deployment
Preview — 128189fe Deployed Oct 30, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants