Skip to content

Feat/add copy page button#13485

Draft
Anderson-Andre-P wants to merge 3 commits into
flutter:mainfrom
Anderson-Andre-P:feat/add-copy-page-button
Draft

Feat/add copy page button#13485
Anderson-Andre-P wants to merge 3 commits into
flutter:mainfrom
Anderson-Andre-P:feat/add-copy-page-button

Conversation

@Anderson-Andre-P

@Anderson-Andre-P Anderson-Andre-P commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Closes #13062

cc @johnpryan

Summary

Adds a "Copy page" button to the options dropdown () in the header of documentation pages, making it easy to copy the full page content to paste into an AI agent prompt.

How it works

  • Clicking "Copy page" fetches the raw Markdown from GitHub (raw.githubusercontent.com) using the page's existing sourceUrl and writes it to the clipboard.
  • On success, the button label changes to "Copied!" with a checkmark icon, and a toast notification appears at the bottom of the screen. Both reset after 2 seconds.
  • The button only appears on pages with more than 150 words of body content (front matter and HTML tags excluded), hiding it from navigation/index pages that have no meaningful content to copy.

Test plan

  • Click "Copy page" on a content page and paste into a text editor — confirm raw Markdown is copied
  • Confirm the button label changes to "Copied!" and the toast appears on success
  • Confirm the button is absent on navigation/index pages (e.g. /ui, /cookbook, /tools)
  • Confirm the button is present on content pages (e.g. /ui/layout/constraints, /cookbook/networking/fetch-data)

@Anderson-Andre-P

Copy link
Copy Markdown
Contributor Author

@johnpryan
Screenshot 2026-06-09 at 8 55 25 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a "Copy page" button for use with AI

1 participant