I'm trying to integrate this into my nextjs13 site in a markdown file that renders blocks of rich text from my headless CMS, i'm using app router. This is probably do to my lack of knowledge with SSR but thought i'd ask here before giving up.
'use client'
import hljs from 'highlight.js';
import CopyButtonPlugin from 'highlightjs-copy';
hljs.addPlugin(new CopyButtonPlugin());
[BLOCKS.EMBEDDED_ENTRY]: (node) => {
const entryId = node.data.target.sys.id;
const entry = description.links.entries.block.find(e => e.sys.id === entryId);
if (!entry) return null;
const highlightedCode = hljs.highlight(entry.code, { language: entry.language }).value;
return (
<div className='syntax-custom overflow-x-auto my-10'>
<p className="text-tiny uppercase font-bold mb-1 text-danger">{entry.language}</p>
<pre className='text-sm hljs-copy-wrapper'>
<code dangerouslySetInnerHTML={{ __html: highlightedCode }} />
</pre>
</div>
);
}