spences10 / ama

Ask me anything!
0 stars 1 forks source link

Getting PrismJS Syntax Highlighting to work with MDX + Gatsby #7

Closed hydrosquall closed 5 years ago

hydrosquall commented 5 years ago

Hi Scott,

Thanks for writing this article. I've been using Gatsby for a few months, and gradually adding pieces to it. Occasionally I've thought about escaping from pure MD to MDX, and this article almost led me to do it!

I was wondering if you were able to get PrismJS or similar syntax highlighting working. Most of my plugins are working after I did the migration (I wasn't using the Gatsby starter, but something very similar). I came across this project for fixing syntax highlighting, but it was broken: https://github.com/sw-yx/gatsby-plugin-mdx-prismjs . The regular gatsby-plugin-remark-prismjs

I suppose now I have the option of using code blocks as React components - but it was just nice before to have the super-light markup option.

Thanks for taking a look ! I'll report back here if I find a good Prismjs component to replace what I was doing before.

hydrosquall commented 5 years ago

Update: I ended up following along with a guide, and converted most of what I needed using a combination of this blog post and some samples from the gatsby-mdx repository.

https://www.christopherbiscardi.com/post/codeblocks-mdx-and-mdx-utils

spences10 commented 5 years ago

Hey @hydrosquall, sorry about not picking this up for four months!

If you're interested I'm in the process of putting together a MDX developer blog which will have syntax highlighting built in

It looks like you have this sorted now, thanks for reaching out 👍