Skip to content

Conversation

@tarunrajput
Copy link
Contributor

Description

This PR adds a copy to clipboard button to code blocks as part of #14006

Checklist

  • I’ve added tests to confirm my change works.
  • (If changing the API or CLI) I’ve documented the changes I’ve made (in the docs/ directory).
  • (If the change is user-facing) I’ve added my changes to changelog_unreleased/*/XXXX.md file following changelog_unreleased/TEMPLATE.md.
  • I’ve read the contributing guidelines.

Try the playground for this PR

image

@thorn0
Copy link
Member

thorn0 commented Jan 10, 2023

@tarunrajput Please make the button's color lighter than the main text.

@fisker
Copy link
Member

fisker commented Jan 11, 2023

docusaurus@2 seems support this feature out of box.

@tarunrajput
Copy link
Contributor Author

docusaurus@2 seems support this feature out of box.

Yes, docusaurus v2 supports this along with code wrap and many other features. Let me know if you have plans to migrate. thanks.

@tarunrajput tarunrajput force-pushed the tarunrajput/add-copy-to-clipboard branch from 92229e7 to 0ca1e96 Compare January 11, 2023 16:53
@fisker
Copy link
Member

fisker commented Jan 12, 2023

Updated to use the same style as docusaurus v2

image
image
image

@thorn0 thorn0 merged commit c1b9765 into prettier:main Jan 12, 2023
medikoo pushed a commit to medikoo/prettier-elastic that referenced this pull request Jan 4, 2024
* feat: add copy to clipboard in code blocks

* Use the same style as docusaurus v2

* Remove style from siteConfig.js

* Fix typo

* Disable button on copied

Co-authored-by: Tarun Chauhan <tarun.chauhan@tripjack.com>
Co-authored-by: fisker Cheung <lionkay@gmail.com>
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