Empty line is inserted between every lines when I paste text into editor

AI-generated summary

When pasting markdown text from VSCode into the Discourse editor, an empty line is inserted between every line, breaking unordered lists and reference blocks. H4M5TER encountered this issue and couldn’t find a solution on the forum.

Don suggested turning off editor.copyWithSyntaxHighlighting in Settings, which worked for him. Alternatively, supermathie proposed forcing a plain text paste, which also resolves the issue. Canapin confirmed that plain text paste works, and shared the shortcut <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>v</kbd>.

supermathie explained that VSCode offers multiple formats when copying text, including text/plain and text/html. The text/plain format doesn’t add extra line breaks, whereas the text/html format does.

H4M5TER thanked everyone for the rapid solution.

I’m finish editing markdown in my VSCode and paste it to the topic editor.
Then empty line is inserted between every lines.

It is annoying that my unordered lists and reference blocks broke into multi parts.

I have searched the forum and didn’t find the same problem.
Any workaround?

I’m just confirming the issue with a video example:

Hello,

I think the problem is that the copied text is formatted.
I found here a solution: https://stackoverflow.com/a/70288252

Go to Settings > Search for editor.copyWithSyntaxHighlighting and turn off. This is worked for me. :slightly_smiling_face:

I suspect the editor is picking up a text/html version and pasting that.

Does it function properly if you force a plain text paste?

I tried and it works. :slight_smile: :+1:

Ctrl+Shift+v for the plain text paste shortcut (some don’t know!).

That’d be it then. vscode offers the following formats:

TIMESTAMP,TARGETS,SAVE_TARGETS,MULTIPLE,STRING,UTF8_STRING,TEXT,chromium/x-web-custom-data,text/html,text/plain,text/plain;charset=utf-8

and the text/plain is (for example):

'use std::collections::HashSet;\nuse std::collections::HashMap;\nuse std::io::BufRead;\nuse std::fmt;\n'

whereas the text/html is:

b'<div style="color: #d4d4d4;background-color: #1e1e1e;font-family: \'Droid Sans Mono\', \'monospace\', monospace;font-weight: normal;font-size: 14px;line-height: 19px;white-space: pre;"><div><span style="color: #569cd6;">use</span><span style="color: #d4d4d4;"> std</span><span style="color: #d4d4d4;">::</span><span style="color: #d4d4d4;">collections</span><span style="color: #d4d4d4;">::</span><span style="color: #d4d4d4;">HashSet;</span></div><div><span style="color: #569cd6;">use</span><span style="color: #d4d4d4;"> std</span><span style="color: #d4d4d4;">::</span><span style="color: #d4d4d4;">collections</span><span style="color: #d4d4d4;">::</span><span style="color: #d4d4d4;">HashMap;</span></div><div><span style="color: #569cd6;">use</span><span style="color: #d4d4d4;"> std</span><span style="color: #d4d4d4;">::</span><span style="color: #d4d4d4;">io</span><span style="color: #d4d4d4;">::</span><span style="color: #d4d4d4;">BufRead;</span></div><div><span style="color: #569cd6;">use</span><span style="color: #d4d4d4;"> std</span><span style="color: #d4d4d4;">::</span><span style="color: #d4d4d4;">fmt;</span></div><br></div>'

Thanks to all of you
Didn’t expected for such rapid solution