Getting Started
starlight-copy-button adds an accessible, polished copy button next to each docs page title in Starlight.
Installation
Section titled “Installation”-
Install
starlight-copy-buttonfrom GitHub:Terminal window pnpm add github:dionysuzx/starlight-copy-buttonTerminal window npm install github:dionysuzx/starlight-copy-buttonTerminal window bun add github:dionysuzx/starlight-copy-button -
Add the plugin to your Starlight
pluginsconfig:astro.config.mjs import starlight from '@astrojs/starlight'import { defineConfig } from 'astro/config'import starlightCopyButton from 'starlight-copy-button'export default defineConfig({integrations: [starlight({title: 'My Docs',plugins: [starlightCopyButton()],}),],}) -
Start your docs site in dev mode and open any docs page:
Terminal window pnpm devTerminal window npm run devTerminal window bun run dev
What gets added automatically
Section titled “What gets added automatically”The plugin:
- Injects client behavior to copy full page Markdown to the clipboard.
- Adds
starlight-copy-button/styles.cssto your StarlightcustomCss. - Skips pages that use Starlight’s hero title layout.