Skip to content
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

Feature: Add copy button to Bash codesnippets #4425

Merged
merged 1 commit into from
Mar 3, 2024

Conversation

Asartea
Copy link
Contributor

@Asartea Asartea commented Mar 2, 2024

Because

It can be helpful to copy long and involved bash commands

This PR

  • Adds a copy button to all code snippets
  • Uses CSS to hide said button for all languages except bash

Issue

Closes #4416

Additional Information

Two notes:

  • The way the CSS works, its hiding the entire toolbar, not just the copy button. The advantage of this is that we don't end up with a bunch of empty divs where the toolbar should be. The disadvantage is that if we ever add something else to that toolbar that would also get hidden, and it might not be immediately obvious why.
  • I'm not entirely convinced by how the button actually works, but I think a possible redesign would be better suited for a follow up PR.

Pull Request Requirements

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • The title of this PR follows the keyword: brief description of change format, using one of the following keywords:
    • Feature - adds new or amends existing user-facing behavior
    • Chore - changes that have no user-facing value, refactors, dependency bumps, etc
    • Fix - bug fixes
  • The Because section summarizes the reason for this PR
  • The This PR section has a bullet point list describing the changes in this PR
  • I have verified all tests and linters pass after making these changes.
  • If this PR addresses an open issue, it is linked in the Issue section

@KevinMulhern KevinMulhern temporarily deployed to odin-review-app-pr-4425 March 2, 2024 16:48 Inactive
@KevinMulhern KevinMulhern temporarily deployed to odin-review-app-pr-4425 March 3, 2024 11:59 Inactive
Copy link
Member

@KevinMulhern KevinMulhern left a comment

Choose a reason for hiding this comment

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

Looks great to me - thanks @Asartea

@KevinMulhern KevinMulhern merged commit 6bb6894 into TheOdinProject:main Mar 3, 2024
@Asartea Asartea deleted the feature/copy-button branch March 3, 2024 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Feature Request: Copy to clipboard buttons on code blocks
2 participants