Open seancdavis opened 2 years ago
I did some research and couldn't find anything that will do this right out of the box.
I found an example of building a custom rehype plugin. There's a lot more going on here than is necessary. May not be all that difficult to do.
How about using https://github.com/timlrx/rehype-prism-plus
export default makeSource({
...
mdx: { rehypePlugins: [highlight, rehypePrism] },
})
I tested it and it looks like this.
@MiryangJung This could definitely work! I'm going to spend some time with the docs site next week and I'll take a look. Thanks for sharing!
@seancdavis You can make use of Rehype Pretty Code, it can also be used to highlight lines in a code snippet. It also has some advantages over prism
e.g, build-time highlighting.
It would be great to be able to highlight lines in code blocks to help focus readers in the documentation.
Tailwind's docs show a nice example of this.