expressive-code / expressive-code

A text marking & annotation engine for presenting source code on the web.

Home Page:https://expressive-code.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Feature] Copy to Clipboard buttons for highlighted lines

Lms24 opened this issue · comments

What is your idea?

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).

image

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.

I think this is especially helpful in situations where you want to instruct people to add a few lines to an already existing function, object, configuration, etc.

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 ;)