Install MDX in a New Gatsby Project

Chris Biscardi
InstructorChris Biscardi

Share this video with your friends

Send Tweet
Published 5 years ago
Updated 3 years ago

Gatsby and MDX make a great pairing. Here's how to set up a new project with gatsby-mdx to write pages and other content using MDX.

Instructor: [00:00] First we'll initialize a new Gatsby project using the default starter. Then we'll install gatsby-mdx and its dependencies, mdx-js/mdx and mdx-js/react. With mdx installed, we'll open our project. We need to modify the gatsbyconfig.js file to add the Gatsby mdx plug-in. Now we can run our project.

[00:39] Once we've run our project, we can take the localhost URL and put it into our browser. Finally, we'll create a new page using an mdx to show that gatsby-mdx and mdx.js are working. Gatsby-mdx includes default support for source pages if we include a file with a .mdx extension. Now the site is rebuilt, we'll go to page 3. This is our mdx file.

infoalberghi
infoalberghi
~ 4 years ago

It's gatsby-mdx deprecated and now replaced by gatbsy-plugin-mdx? I found docs a bit confusing.

Chris Biscardi
Chris Biscardiinstructor
~ 4 years ago

gatsby-mdx is the pre-1.0 version of gatsby-plugin-mdx. At 1.0 it was merged into the Gatsby monorepo and the name was changed.