[Code Blocks] Copy to Clipboard button for highlighted lines #1222
Replies: 2 comments 2 replies
-
I am 99% in favor of this suggestion, 1 Thing I find difficult would be how many clipboard button will be displayed on mobile devices for such cases (generally 1 clipboard button is displayed by default as seen in Starlight codeblocks) |
Beta Was this translation helpful? Give feedback.
-
Thank you for the praise regarding Expressive Code and this feature request! As Expressive Code has its own repo, it would be great if you could open your feature request there. We are actually already discussing a related request there (expressive-code/expressive-code#92), but I think your request is different and should be tracked separately. The timing of this idea is perfect and helps me a lot to come up with an implementation that solves both cases. :) |
Beta Was this translation helpful? Give feedback.
-
What version of
starlight
are you using?0.13.0
What is your idea?
Hi folks! We're currently using Starlight for writing docs for our new tool, Spotlight. First off, I love the expressive code blocks features 😍 Makes code blocks so much more helpful for users!
One idea to take them to the next level: I'd love to be able to add copy to clipboard buttons to individually selected highlighted lines (or blocks).
Looking at this example in the screenshot, if I hover over lines 2, 8 or 14-16, individual copy to clipboard buttons would show up and clicking them would only copy the respective line(s).
Why is this feature necessary?
As a user I’m rarely able to use the copy/paste button on longer code blocks like the one in the screenshot. Usually I only need the highlighted lines and don’t want the others. Copying the entire thing at this point is more work than manually selecting the highlighted lines.
Do you have examples of this feature in other projects?
I don't know websites or frameworks that allow for this but I've always wondered why it's not a thing... Maybe I'm missing an obvious UX flaw with this but to me it'd be an awesome feature! So this could be a USP at this point ;)
Participation
Beta Was this translation helpful? Give feedback.
All reactions