This is a powerful enhancement of standard Markdown, but in my opinion, it also has a big drawback: It’s not standard Markdown.
When we decided to use Markdown for blog posts, we didn’t do that only because Markdown is a nice, light-weight mark-up language, but also because it is widely supported by all kinds of tools and environments. What if someday we decide to move our blog to another framework that doesn’t support MDX? What if we want to replicate blog posts on other platforms like Medium or Dev.to? Maybe we want to write our blog posts directly in GitHub or GitLab without the need to compile the whole page.
Because of those thoughts, we decided to go with plain Markdown instead of MDX. I write this very post in Visual Studio Code with a default Markdown previewer and can be sure, that the compiled version will look sufficiently close to what I see:
Following “Adding Markdown Pages“, we use two plug-ins to convert our Markdown blog posts:
- gatsby-source-filesystem: read arbitrary source files and provide them for the Gatsby build system
- gatsby-transformer-remark: transform Markdown to HTML and provide metadata like author and title
The later reads metadata from key-value pairs provided in the header of each Markdown blog post. The following is an excerpt from this post’s header: