Closed fsgreco closed 5 years ago
You can configure gatsby-plugin-mdx
to also parse .md
files: https://www.gatsbyjs.org/packages/gatsby-plugin-mdx/#extensions
This is the solution you should go for. I personally haven't seen a performance difference between remark and MDX. The MDX runtime happens at build time, nothing will be loaded in the browser (same with remark).
@LekoArts thanks for the answer. I did indeed parse .md
files at first, but since I'm coming from blogspot my .md
files are plenty of html and iframes. It's not a problem when I'm using gatsby-transformer-remark
, but it generates some errors width mdx. (also it seems that unlike markdownRemark it return some errors when don't found some values on frontmatter: for example some post have a description value inside frontmatter, some not. With transformer-remark
wasn't a problem, but with mdx it is).
So if I keep my old ones in md, and use transformer-remark
, while use mdx only for new posts, the only downside should be more building time, right?
Oh, misunderstood you then. Yes, you can use gatsby-plugin-mdx
alongside gatsby-transformer-remark
, we did that on gatsbyjs.org for the interim period (switching to MDX), too. Shouldn't really add much to the build time I think.
but it generates some errors width mdx.
If you can reproduce this with a reproduction, please open up a new issue.
also it seems that unlike markdownRemark it return some errors when don't found some values on frontmatter
You'll want to use the schema customization API to fix your types for that then :)
You'll want to use the schema customization API to fix your types for that then :)
Thanks! Didn't know this schema, it could be useful! I'll try to fix all the errors then, in case there's something I can't solve will try with a reproduction.
Summary
I'm working on a migration for my gatsby blog in order to shift from plain markdown posts to mdx. I have 260 posts, and as I face problems with the old sintax (they have html inside from old blogging platform) I'm asking myself if maybe it could be useful to keep old posts in plain markdown and use mdx only for the new ones.
Is that convenient?
Also, from a performance point of view, is mdx more performant or its power has it cost in terms of resources from the browser?