Part 1. GatsbyJS How to enable MDX
In GatsbyJS prompt, install the starter project.
E:\Repo\Tests> gatsby new myproject https://github.com/gatsbyjs/gatsby-starter-default
This creates a new folder called myproject in which all the code and dependencies are imported. Open the Folder with Visual Studio Code. In the Terminal window, execute the command below to run the website :
|
|
You can now see the website in live by clicking on http://localhost:8000/
Now let’s add a folder Blog under src/pages and add 1 file named post1.mdx :
|
|
Let’s install the MDX plugin :
Then add the plugin in the gatsby-config.jsx
|
|
After changing the config, run the development again with
E:\Repo\Tests> gatsby develop
Now go to the following url : http://localhost:8000/Blog/post1
The page has been created automaticaly and is now accessible.
The HTML of our post looks like this :
|
|