Closed Tebaeleven closed 1 year ago
The meta strings require specifying how you want to manipulate the nodes in the options object — you haven't yet specified onVisitHighlightedWord
to manipulate the node and allow any styling to appear.
onVisitHighlightedWord(node, id) {
node.properties.className = ['word'];
if (id) {
// If the word spans across syntax boundaries (e.g. punctuation), remove
// colors from the child nodes.
if (node.properties['data-rehype-pretty-code-wrapper']) {
node.children.forEach((childNode) => {
childNode.properties.style = '';
});
}
node.properties.style = '';
node.properties['data-word-id'] = id;
}
}
I had overlooked it. Thank you so much for your help!
I was able to syntax-highlight the code displayed in MDX using rehype-pretty-code in Next13, but here is the site (https://rehype-pretty-code.netlify.app/ ) However, all of the Meta strings listed on this site do not work.
I have done a lot of research and could not figure out why, so I would appreciate it if you could let me know.
Below is the actual code and an image of Meta strings not working. MDX file
dependencies