00:01
00:00
Chooce video playback speed
Speed1
  1. 2
    Add Prism Highlighting to a Gatsby Blog Theme site
    50s

Add Prism Highlighting to a Gatsby Blog Theme site

Share this video with your friends

Send Tweet

Use the built-in prismPreset option to add prism highlighting to gatsby-theme-blog.

Note that this is only available in Blog Theme 2.0 and beyond.

Laurie Barth: To set up code snippets in your site, first add one. In this case, it uses the JavaScript language, and we're going to add a code snippet that sets a new constant called variable with some string value.

Go to your gatsby-config file and edit your setup for your gatsby-theme-blog plugin. Add the option prismPreset and set whichever theme UI preset you'd like to use for prism, in this case prism-okaidia.

Run gatsby develop and navigate to your blog post. Once there, you can see your code snippet with prism highlighting.