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
30 days ago I posted here with $0 revenue. Here's what actually happened next. User Avatar 152 comments Fixing broken scrapers instead of working on my actual product. So I made it my problem. User Avatar 39 comments I Built a Habit Tracker SaaS Alone in 6 Weeks (No CS Degree, No Team). Here's Exactly How User Avatar 39 comments I built an open-source PII masking layer for LLM APIs — early traction, looking for design partners User Avatar 29 comments How to see revenue problems before they get worse User Avatar 25 comments I built a WhatsApp AI bot for doctors in Peru — launched 3 weeks ago, 0 paying customers, and stuck waiting for Meta to approve my app User Avatar 14 comments