pre-formatted text has extra spaces at end-of-line upon copy/paste
I'm using "Marked 2" Version 2.6.33 (1057)
I have noticed that when displaying pre-formatted text (text indented four spaces, or eight spaces inside a list), Marked displays it as expected, but if I want to copy and paste the text to something else, two extra spaces are added at the end of the line.
Here is a contrived example:
gcc \
--version
Here on Tender, you can copy and paste that to a shell and (if you have gcc installed) it will work as expected. It also works when displaying it in VSCode's Markdown preview, and with how github displays Markdown on the web. It works because the text you get upon copying has "\" at the very end of the line, so "\" can work as intended as line continuation in the shell. You can verify this on a Mac, after copying from the displayed Markdown, with (you'll have to type this line yourself, without relying on copy/paste):
pbpaste | cat -tve
it should display something like:
gcc \$
--version%
where the "$" is cat's way of saying "here is the end of the line": the "\" immediately preceded the newline.
But, when you copy from Marked, and run the pbpaste command, you'll see:
gcc \ $
--version%
Notice that there are two spaces after the "\" before the newline. The pasted command does not work in the shell because it sees the space after "\" as an escaped space (before the other space), and then a newline terminating the command (oops), and then "--version" as a (broken) stand-alone command.
Why are there space added?
This needlessly breaks the ability to use Marked to legibly display technical documentation about multi-line commands to be used in a unix shell.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac