-
Notifications
You must be signed in to change notification settings - Fork 158
Adds a copy-to-clipboard button for code blocks in the documentation to improve developer experience. #646
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: master
Are you sure you want to change the base?
Adds a copy-to-clipboard button for code blocks in the documentation to improve developer experience. #646
Conversation
- Add copy button that appears on hover for all code blocks - Include visual feedback with 'Copied!' confirmation - Support both modern and fallback clipboard APIs - Style with Primer design system conventions - Mobile-friendly with always-visible button on touch devices Fixes probot#645
_layouts/default.liquid
Outdated
| rel="stylesheet" | ||
| href="/assets/dist/styles.css" | ||
| /> | ||
| <link rel="stylesheet" href="/assets/css/copyIcon.css" /> |
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.
This should be in the _layouts/docs.liquid file
_layouts/default.liquid
Outdated
| </head> | ||
| <body> | ||
| {% include "nav" %} {{ content }} {% include "footer" %} | ||
| <script src="/js/copyIcon.js"></script> |
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.
This should be in the _layouts/docs.liquid file
assets/css/copyIcon.css
Outdated
| color: #57ab5a; | ||
| border-color: #57ab5a; | ||
| } | ||
| } No newline at end of file |
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.
| } | |
| } | |
js/copyIcon.js
Outdated
| document.addEventListener("DOMContentLoaded", addCopyButtons); | ||
| } else { | ||
| addCopyButtons(); | ||
| } No newline at end of file |
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.
| } | |
| } | |
|
Done with the changes |
|
HEY, Just made the changes. Can you review it and let me know if anything else needs to be done? |
Fixes #645
Changes
Implementation
js/copy-code.jswith copy functionality and button creation logicassets/css/copy-code.csswith styling for the copy button_layouts/default.liquidto include the new CSS and JS filesFor any feature updates or any other details, Contact - github.com/Rishi2600