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

Code copy button without adding new line #6323

Closed
4 tasks done
maxsitt opened this issue Nov 12, 2023 · 1 comment
Closed
4 tasks done

Code copy button without adding new line #6323

maxsitt opened this issue Nov 12, 2023 · 1 comment
Labels
bug Issue reports a bug upstream Issue must be taken upstream

Comments

@maxsitt
Copy link

maxsitt commented Nov 12, 2023

Context

No response

Description

Currently, when copying code with the code copy button, a new line is automatically added when pasting the copied code somewhere else. This does not happen if the code is copied manually by selecting everything in the code block. The expected behaviour of copying the code with the code copy button should be to copy only the content in the code block, without adding a new line.

Related links

Use Cases

Especially when copying code that should be run in a Terminal/command prompt, the new line that is automatically added when copying the code with the code copy button can lead to problems in some cases, e.g. code is run immediately when pasting. Expected behaviour of the code copy button should be exactly the same as for copying code manually: copy only the content in the code block without adding a new line.

Visuals

No response

Before submitting

@squidfunk
Copy link
Owner

squidfunk commented Nov 12, 2023

Thanks for suggesting. Actually, this sounds more like a potential bug report, but it does not have a reproduction. If so, it is either related to Python Markdown or to Clipboard.js, since we're only providing the glue between both. We use the HTML that comes out of Python Markdown and add the copy button. Thus, please report this upstream. I recommend to create a minimal reproduction to understand where the newline is coming from.

@squidfunk squidfunk added bug Issue reports a bug upstream Issue must be taken upstream labels Nov 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue reports a bug upstream Issue must be taken upstream
Projects
None yet
Development

No branches or pull requests

2 participants