Terminal flavored code block copy button should not copy a carriage return

This was originally reported as a bug but I was told to make a feature request instead. It’s still a bug in the sense that the actual behavior is different than the expected behavior so it doesn’t really fit in the standard feature request template.

Use case or problem

I’m writing documentation for my linux server and the copy button is very handy except the presence of the carriage return means that any command I need to modify before executing has to be manually copied instead of using the copy button.

Proposed solution

Steps to reproduce

  1. Create a bash flavored code block
ls /home
  1. Preview the file

  2. Click Copy on the code block

  3. Paste into a bash terminal

Expected result

Copied command pastes into the terminal but isn’t executed because a carriage return was not copied with it

Actual result

Command executes without having to hit return making it difficult to verify or modify the pasted command before executing it.