-
-
Notifications
You must be signed in to change notification settings - Fork 129
Implement copy as markdown button #1218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR implements a "Copy as markdown" button feature for Starlight documentation pages. The feature allows users to copy the raw markdown content of a page to their clipboard with a single click.
- Adds build-time markdown bundling to avoid runtime file I/O operations
- Implements client-side copy functionality with clipboard API and fallback support
- Creates a custom PageTitle component that integrates the copy button into the page header
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| content/src/lib/markdown-map.ts | Build-time markdown content bundling and retrieval utilities |
| content/src/components/starlight/copy-page.client.ts | Client-side copy functionality with clipboard handling and UI state management |
| content/src/components/starlight/PageTitle.astro | Custom PageTitle component with integrated copy button and styling |
| content/package.json | Added onlyBuiltDependencies configuration |
| content/astro.config.ts | Registered custom PageTitle component override |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
a0a4d14 to
3ef5c65
Compare
3ef5c65 to
6985502
Compare
|
@IMax153 I think this is good to go actually :) |
|
@kitlangton - I fixed the issue I mentioned and deployed it to the preview env. However, I'm not sure if it's just me, but it doesn't seem to be working in the live preview. Doesn't copy the page content. |
|
Hrm. Do you have a link to the preview? |
@kitlangton you can click the preview link for website-content in the comment generated by Vercel at the top of the PR |
Description
Adds a “Copy page” action to Starlight docs. The custom PageTitle component bundles raw markdown at build time, ensures each document starts with its H1, and exposes it via a hidden template. A lightweight client script wires the button to copy the markdown and updates status messaging for success or failure.