If a user copies and pastes
```sh
systemctl reboot
```
into the edit form in Discourse, that content becomes
||```sh|
|---|---|
||systemctl reboot|
||```|
This is erroneous – it’s obviously a list, not a table.
I’ve tested this on discuss.kde.org and meta.discourse.org .
```sh
systemctl reboot
```
```sh
systemctl reboot
```
@JammyDodger , try it again. I’ve removed the list number. It seems to reliably work now.
By the way, select-quoting your comment gives me
[quote="JammyDodger, post:2, topic:266325"]
Reboot:
0. ```
systemctl reboot
```
```
0. Reboot:
```sh
systemctl reboot
```
```
[/quote]
…is that correct?
I have to admit, I’m not entirely sure what I’m meant to be copying and pasting at this point.
Haha.
```sh
systemctl reboot
```
When copying the text from the page by drag-selecting it I get:
But copying it using the copy button:
I properly get just the expected text upon pasting.
Clipboard contents using the “copy” button are:
TEXT:
b'```sh\n\tsystemctl reboot\n\t```'
text/plain:
b'```sh\n\tsystemctl reboot\n\t```'
Clipboard contents by drag-selecting it on the page are:
TEXT:
b'\t```sh\n\tsystemctl reboot\n\t```'
text/html:
b'<span style="color: rgb(199, 199, 199); font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace; font-size: 17.008px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: pre-wrap; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(60, 60, 60); text-decoration-thickness: initial; text-decoration-style: initial; text-decoration-color: initial; display: inline !important; float: none;">\t```sh\n\tsystemctl reboot\n\t```</span>'
text/plain:
b'\t```sh\n\tsystemctl reboot\n\t```'
It’s probably that tab stop at the beginning of each line confusing things - perhaps if while parsing clipboard contents the first column is always empty we don’t treat it as a list.
This seems a bit of a pathological situation - is there a natural situation where it comes up? Normally there won’t be tab stop characters in posts.
Beedell, Roke Julian Lockhart:
it’s obviously a list, not a table
To a computer it looks exactly like a tab-delimited table with a blank first column.
7 Likes
Lilly
May 27, 2023, 5:37am
8
one thing i’ve learned over the years is never trust the drag-select copy and paste…
That should probably be determined by the user, using
```tsv
```
After all, a tab-delimited table shouldn’t work with word-wrapping enabled, so it rather has to be enclosed with something that forces scrolling.
And, of course, also because indentation (to delimit a list or fenced codeblock)
is also very valid (and common) markdown.