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 Request - Not Copying the "$" or "#" in the beginning #64

Open
osalbahr opened this issue Mar 26, 2023 · 1 comment
Open

Feature Request - Not Copying the "$" or "#" in the beginning #64

osalbahr opened this issue Mar 26, 2023 · 1 comment

Comments

@osalbahr
Copy link

Is there a way to copy element text content or input values to the clipboard, without the leading dollar sign "$" but still keep it displayed in the README preview?

For example, in README.md, copying the first command copies the "$" in the beginning, i.e. $ npm install --save @github/clipboard-copy-element. However, that can cause some issues:

$ $ npm install --save @github/clipboard-copy-element
-bash: $: command not found

One solution is to have the command not include the "$". But its inclusion is conventional for "run as non-root" as opposed to prepending the command with "#" which indicates running the command as root.

@naiyerasif
Copy link

naiyerasif commented Jun 22, 2024

I had a similar use case to exclude prompt characters (such as $). The way I solved this is to wrap those characters in a span with aria-hidden=true and exclude them from the copied text.

Here's the patch which tackles this: https://github.com/naiyerasif/site/blob/fc48785799bc40a061ca95aee77a8a8d5b2e81b0/src/modules/clipboard-copy/clipboard.js#L12

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

No branches or pull requests

2 participants