I wanted to format the code snippets from a Contentful rich text field and use syntax highlighting.
To begin I created a Code Snippet content type with a markdown field and then in my Rich text component I added a renderNode for the content type.
I started by trying out this package https://github.com/react-syntax-highlighter. I kept getting this error
"Super expression must either be null or a function"
Looking around I believed it to be a problem with server side and client side. I tried "use client"; in the head of my component and import dynamic from "next/dynamic"; to render the component client side, but still getting the error. Looking at the Next 13 docs, I needed to move my component into the app directory in order for the "use client to work".
and here is an example of the Rich text component: