I was looking for a way to add a copy code feature to code blocks in my blog, built with Astro. A google search led me to a few articles. The first four suggested home made solutions. The fifth was not exactly an article on how to add the feature but a Astro development discussion that quoted, in passing, the package used by Starlight.
That's it, to add a copy code feature to your code blocks in Astro, just install astro-expressive-code:
yarn astro add astro-expressive-code
# or
npx astro add astro-expressive-code
Besides code copying, the package also provides other features.
Top comments (0)