1×
Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.

Autoplay

    Processing Markdown File Extensions with Gatsby MDX

    Chris BiscardiChris Biscardi
    reactReact
    gatsbyGatsby

    Some platforms support .md file extensions better than they support .mdx. For this reason (or others) it can be useful to apply MDX processing to files with .md extensions as well as .mdx extensions.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Discuss

    Discuss

    Transcript

    Transcript

    Instructor: Here we have a running Gatsby site, an mdx file and the result of that mdx file. Note that our Gatsby site is configured with Gatsby MDX because we haven't passed in any options like we have for other plugins.

    It's using the default config. The default configuration for Gatsby MDX only applies to files with .mdx in the file name.

    Note that moving the pageThree.mdx file to pageThree.md results in a page that doesn't exist because Gatsby MDX has not set up to process .md files.

    To enable Gatsby MDX to process .md files, as well as .mdx files, we'll use the extensions option in Gatsby MDX's config. Note that any time you change the Gatsby config.js file, you must restart the Gatsby process.

    Now when we refresh the page, we can see that pageThree.md is now considered an MDX file.