Trying to use remark-highlight.js:
{
mdPlugins: [
require('remark-highlight.js')
]
}
But what I got is:

@johno this is actually a bug in mdx's wrapping of code tags.
For anyone else who stumbles on this in the future trying to add syntax highlighting to MDX, here are the steps + diffs it required for me:
remark, this adds the most popular syntax highlighting plugin (remark-highlight.js). Note that this actually uses lowlight under the hood. Also note that this only breaks up markdown code block syntax groups into separate elements with highlight.js/lowlight classnames, it doesn't actually color anything.remark-highlight.js parsing isn't that great so most code will only be partially colored (a good amount of the code I have tried isn't wrapped in any semantic syntax groups in the output so it inherits the base CSS color). In my diff I added my own custom theme, but it looks like you could use any from highlight.js: https://github.com/isagalaev/highlight.js/tree/master/src/styles.@trevordmiller thank you guys! it works
@trevordmiller Great helps! It helps me a lot.
Hey folks! tip: use hastPlugins with rehype-highlight (lowlight) or @mapbox/rehype-prism (refractor) instead!
There are some slight differences and I鈥檇 suggest using the rehype versions above remark versions!