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

Add copy button to Markdown codeblocks #7451

Merged
merged 5 commits into from
Oct 31, 2024
Merged

Add copy button to Markdown codeblocks #7451

merged 5 commits into from
Oct 31, 2024

Conversation

philippjfr
Copy link
Member

Implements #6209

copy_button

@MarcSkovMadsen
Copy link
Collaborator

Would be so great for chat and many other use cases.

@ahuang11
Copy link
Contributor

ahuang11 commented Oct 30, 2024

One feature that I really like about ChatGPT is how the "Copy Code" follows the scroll position, up to the end of the code, so users don't have to scroll all the way up to copy. Is it easy to implement that feature?

Screen.Recording.2024-10-30.at.9.24.55.AM.mov

Copy link

codecov bot commented Oct 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.24%. Comparing base (8dd362f) to head (30dd111).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7451      +/-   ##
==========================================
+ Coverage   82.08%   82.24%   +0.16%     
==========================================
  Files         337      337              
  Lines       50680    50680              
==========================================
+ Hits        41599    41684      +85     
+ Misses       9081     8996      -85     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Coderambling
Copy link
Contributor

Coderambling commented Oct 30, 2024

One feature that I really like about ChatGPT is how the "Copy Code" follows the scroll position, up to the end of the code, so users don't have to scroll all the way up to copy. Is it easy to implement that feature?

Screen.Recording.2024-10-30.at.9.24.55.AM.mov

If the "follow" functionality is tricky to implement, maybe simply put an instance of the copy button at the end of the code block, as well as the beginning? Would also be a little less busy than a "following" button.

@philippjfr
Copy link
Member Author

Will skip the following behavior for now. Adding two buttons is definitely too busy.

@philippjfr philippjfr merged commit dc2fce3 into main Oct 31, 2024
18 checks passed
@philippjfr philippjfr deleted the codeblock_copy_icon branch October 31, 2024 09:33
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