Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I ran into many issues with gatsby remark plugins when migrating to
gatsby-plugin-mdx
. Issues and solutions are recorded below.gatsby-remark-autolink-headers
The plugin injected some style into
<head/>
. Somehow it is missing with mdx. I am copy pasting the style inglobal.css
.toc
gatsby-plugin-mdx
exposes data structure as toc, which is better than gatsby remark's plain html version.I reworked the toc implementation based on this blog post.
https://www.bram.us/2020/01/10/smooth-scrolling-sticky-scrollspy-navigation/
The scroll spy logic is encapsulated in
scroll-spy-hook.js
small cap
With
gatsby-remark-smallcaps
, the page appears to render correctly in the browser, but there is error in the browser console.To solve this issue, I rewrote
gatsby-remark-smallcaps
as a rehype plugin.Useful resources to start with writing rehype plugins:
Remaining issue:
katex
gatsby-remark-katex
doesn't seem to work withgatsby-plugin-mdx
.I used solution from the following issue comment and it worked.
gatsbyjs/gatsby#20538 (comment)
Note that:
gatsby-remark-katext@^3.0.0
, version 4 does not work.