1
1 Comment

Copy to clipboard button in MDX with Next.js and Rehype Pretty Code

This tutorial will guide you on how to create a 'copy to clipboard' button for the code snippets processed with Rehype Pretty Code plugin for syntax highlighting in Next.js. We'll be using Next.js 13+ with the 'app' directory enabled.

submitted this link to Icon for group Developers
Developers
on March 18, 2023
  1. 1

    Thank you for this detailed tutorial. Since 9 days the Rehype Pretty Code plugin comes with an inhouse copy-to-clipboard solution. It is available on npm under the package name "@rehype-pretty/transformers".

Trending on Indie Hackers
I built a web-based vector editor from scratch and integrated an AI Agent. Need just ONE beta tester! User Avatar 64 comments Why Your Users are Leaving in Silence (and How to Fix the "Leaky Bucket" with AI) User Avatar 21 comments Launched 580 landing pages in 1 week. Solo. No team. User Avatar 18 comments "Looks Good to Me" Is Quietly Killing Your Feedback Loop User Avatar 12 comments I built an AI that turns an idea into a live business in under 10 minutes. Here’s what 1,000 launches taught me User Avatar 11 comments Building Noodle, a keyboard-first REST client for the terminal User Avatar 11 comments