Skip to content

feat: implement copy button for code snippets#6530

Open
Apolo151 wants to merge 2 commits into
pipe-cd:masterfrom
Apolo151:docs-copy-code-button
Open

feat: implement copy button for code snippets#6530
Apolo151 wants to merge 2 commits into
pipe-cd:masterfrom
Apolo151:docs-copy-code-button

Conversation

@Apolo151
Copy link
Copy Markdown

What this PR does:

Adds a copy button to all code snippets in the docs.

Before
image

After
image

Why we need it:
Better UX for users and contributors.

Which issue(s) this PR fixes:

Fixes #6526

Does this PR introduce a user-facing change?:
Yes

  • How are users affected by this change Better UX, Users can copy any code snippet by simply clicking the button instead of having to select the text.

  • Is this breaking change: No, users can still select the code snippet as usual.

  • How to migrate (if breaking change): NA

@Apolo151 Apolo151 requested review from a team as code owners February 12, 2026 14:16
@rahulshendre
Copy link
Copy Markdown
Contributor

Hi @Apolo151, thanks for the PR.
The DCO check is failing. Please add a sign-off to the commit and re-push so the check can pass.

@Apolo151 Apolo151 force-pushed the docs-copy-code-button branch from 820ba8d to 2853918 Compare February 13, 2026 09:59
@Apolo151
Copy link
Copy Markdown
Author

Hi @rahulshendre,

I have added the sign-off, sorry for the inconvenience.

@github-actions
Copy link
Copy Markdown
Contributor

This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

@github-actions github-actions Bot added the Stale label Mar 16, 2026
@eeshaanSA
Copy link
Copy Markdown
Contributor

@rahulshendre @Ayushmore1214 everything else looks good?

Copy link
Copy Markdown
Contributor

@rahulshendre rahulshendre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM overall @eeshaanSA.
One note: on some code blocks the copy button slightly overlaps the first line of code. It’s still readable, but might be worth a small space tweak for clarity.
What do you think?

Image

Copy link
Copy Markdown
Contributor

@Ayushmore1214 Ayushmore1214 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to go but the issue raised by @rahulshendre need to be fixed!

@github-actions github-actions Bot added area/docs and removed Stale labels Mar 17, 2026
@Apolo151
Copy link
Copy Markdown
Author

Hi @rahulshendre @Ayushmore1214,

I have updated the style to push the copy button to the top a little to handle the overlap.
Let me know if you think anything else needs improvement.

image

@Apolo151 Apolo151 force-pushed the docs-copy-code-button branch from 2fef4a6 to e91ad02 Compare March 17, 2026 22:42
Copy link
Copy Markdown
Contributor

@rahulshendre rahulshendre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @Apolo151
@eeshaanSA, before merging
One small nit: there seems to be a bit of extra space between the code and the copy button. Should we tighten that? Thoughts?

Image

@eeshaanSA
Copy link
Copy Markdown
Contributor

@rahulshendre, thanks a lot. I think it is good to do. Since we have no way of seeing this in production, let us see where this is going. We can always rollback if it is bad, or improvise with more changes later. Thanks gentlemen.

@rahulshendre
Copy link
Copy Markdown
Contributor

Since we have no way of seeing this in production

We should start to work upon this, i'll follow up on the discussions we've already had and add this to the agenda for the next community meeting

Copy link
Copy Markdown
Contributor

@eeshaanSA eeshaanSA left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@riahtgl
Copy link
Copy Markdown
Contributor

riahtgl commented Apr 14, 2026

Hi @eeshaanSA, I've approved this PR.

@rahulshendre
Copy link
Copy Markdown
Contributor

@eeshaanSA, I think we are good to go with this
PTAL

@Apolo151 Apolo151 force-pushed the docs-copy-code-button branch from 0a8492b to 61a9aa5 Compare May 10, 2026 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Docs: add copy button to code snippets

5 participants