Skip to content

Adding a CopyButton feature#537

Open
yufi16 wants to merge 1 commit intoflatcar:mainfrom
yufi16:styling-work
Open

Adding a CopyButton feature#537
yufi16 wants to merge 1 commit intoflatcar:mainfrom
yufi16:styling-work

Conversation

@yufi16
Copy link

@yufi16 yufi16 commented Mar 5, 2026

What this PR does / why we need it:

Introducing a Copy button feature to quickly copy code snippets, reducing friction and saving time.

Which issue(s) this PR fixes:

#2022 -> flatcar/Flatcar#2022

Does this PR introduce a user-facing change?

Enhancing code blocks with distinct background, improving readability and visual clarity.

Special Notes for your Reviewer:

Consolidated suggested changes, looking forward for the feedback

Copy link
Collaborator

@tormath1 tormath1 left a comment

Choose a reason for hiding this comment

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

Thanks for the PR, while I'm not a front-end developer, I'll delegate this PR review to @ervcz :)

.idea/.gitignore Outdated
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's avoid adding the .idea folder. We can .idea to the main .gitignore file.

Copy link
Author

Choose a reason for hiding this comment

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

Thanks for sharing @tormath1
With a couple more changes, will stash them before opening the PR for review.

@John15321
Copy link
Member

Linking it for visibility 😊 flatcar/Flatcar#2022

@sayanchowdhury
Copy link
Member

Thanks a lot for the PR!

The implementation needs to change a bit, currently the copy button is rendered outside of the codeblock - which does not look good in UI terms.

It would be better to use a font-awesome icon and place it within.

Other thing is we use pygments, but you can switch over to use Hugo's highlight which give much more better themes for the code block.

@yufi16 yufi16 force-pushed the styling-work branch 6 times, most recently from 6ba5054 to 63efd51 Compare March 18, 2026 09:21
@yufi16 yufi16 changed the title adding a copy button | scss styling Adding a Copy button | Scss styling Mar 18, 2026
@yufi16 yufi16 changed the title Adding a Copy button | Scss styling Adding a Copy button | Scss Styling Mar 18, 2026
@yufi16 yufi16 changed the title Adding a Copy button | Scss Styling Adding a Copy button | scss styling Mar 18, 2026
@yufi16 yufi16 changed the title Adding a Copy button | scss styling Adding a Copy button | Scss styling Mar 18, 2026
@yufi16 yufi16 marked this pull request as ready for review March 18, 2026 12:25
@yufi16 yufi16 requested a review from a team as a code owner March 18, 2026 12:25
@John15321
Copy link
Member

Could you please remove the .idea folder from Git?

@John15321
Copy link
Member

John15321 commented Mar 18, 2026

Hmm (when running locally), when I use the copy button it adds new lines to each of the lines after pasting it in:
image

http://localhost:1313/docs/latest/installing/vms/vagrant/#:~:text=List%20the%20status%20of%20the%20running%20machines%3A

@yufi16
Copy link
Author

yufi16 commented Mar 18, 2026

Hmm (when running locally), when I use the copy button it adds new lines to each of the lines after pasting it in: image

http://localhost:1313/docs/latest/installing/vms/vagrant/#:~:text=List%20the%20status%20of%20the%20running%20machines%3A

Thanks for investigating, looking into this!

@yufi16 yufi16 force-pushed the styling-work branch 2 times, most recently from d60df88 to 0d25884 Compare March 19, 2026 00:32
Signed-off-by: yusuf <yufi.alam@outlook.com>
Signed-off-by: yussaffi <yufi.alam@outlook.com>
@yufi16 yufi16 force-pushed the styling-work branch 3 times, most recently from 75b28f1 to 9d34850 Compare March 19, 2026 03:49
@yufi16 yufi16 closed this Mar 19, 2026
@yufi16 yufi16 reopened this Mar 19, 2026
@yufi16 yufi16 changed the title Adding a Copy button | Scss styling Adding a CopyButton feature Mar 19, 2026
@sayanchowdhury
Copy link
Member

Hmm (when running locally), when I use the copy button it adds new lines to each of the lines after pasting it in: image

http://localhost:1313/docs/latest/installing/vms/vagrant#:~:text=List the status of the running machines%3A

I see that the innerText that you are using is returning a \n in the end - you could switch to textContent and check. For this example textContent returns me without the trailing newline.

or better just use trim() or trimEnd() to stay on the safer side.

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.

4 participants