-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open
Description
Context
No response
Bug 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.
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.
Related links
- Code copy button documentation
- Previously mentioned in Code copy button without adding new line #6323
Reproduction
Steps to reproduce
- Create new mkdocs project with all required packages up to date (2023-11-13).
- Add the code copy button feature to the
mkdocs.yml:theme: name: material features: - content.code.copy - Add a code block in
index.md. - From the served/built site, copy the code manually by selecting the content in the code block and paste it to an empty text document: no new line is added.
- Copy the code with the code copy button: a new line is added.
Browser
No response
Before submitting
- I have read and followed the bug reporting guidelines.
- I have attached links to the documentation, and possibly related issues and discussions.
- I assure that I have removed all customizations before submitting this bug report.
- I have attached a .zip file with a minimal reproduction.
Metadata
Metadata
Assignees
Labels
bugIssue reports a bugIssue reports a bugresolvedIssue is resolved, yet unreleased if openIssue is resolved, yet unreleased if open