Users are reporting that when pasting Markdown lists (bullet or numbered) or plain text into Discourse, extra carriage returns are automatically inserted between lines, causing unintended spacing. RangerRick first observed this behavior in both this Discourse instance and their own at https://opennms.discourse.group, noting it began a few months ago. The issue persists regardless of the “traditional markdown linebreaks” setting but is resolved by disabling “enable rich text paste” — suggesting the rich text paste handler is misinterpreting or converting clipboard content. maiki and sam suspect the problem may originate from the VSCode plugin “Markdown All In One,” which might be copying content as HTML rather than plain Markdown, causing Discourse to misconvert it. RangerRick confirms using VSCode on Mac with that plugin, though the copied content appears as plain text. maiki and Stephen suggest testing with other editors (e.g., TextMate) to isolate whether the issue is specific to VSCode or the plugin. The consensus leans toward a clipboard/HTML conversion bug in the VSCode plugin, though further debugging of the clipboard’s HTML content is needed to confirm.
Sometime in the last couple of months, Discourse has started adding carriage returns between bullet list entries when I paste markdown into a new post window.
For example, when I copy a simple list from my text editor:
I have confirmed this happenswhen I paste into this discourse, even, right here, in this text input box, like so:
foo
bar
baz
Incidentally, when I pasted above into a ``` section I had already started at the top for the example text, it pasted properly (but of course didn’t get formatted into bullet points).
Oh, I just thought of something. Wonder if it does it for numbered lists too?
foo
bar
baz
…yup.
And I just tried 3 lines of just text, and it appears to do the same, it’s adding carriage returns to everything:
I’ve tried changing this setting and it seems to have no effect on pasting adding extra linebreaks to the resulting input.
I did find the “enable rich text paste” option while looking for that, and I can confirm that turning it off fixes things. So it appears that enabling that mangles markdown even though it should presumably only be doing HTML?
The first thing that popped in my head: are you sure it isn’t HTML? As in, when it’s copied to your buffer from wherever, is it still markdown, or did it convert markdown into HTML, and then is trying to reverse it back.
Just a random thought, probably a bug. But there are so many IDE and text editors that are essentially browser windows…
It’s VSCode with the Markdown All In One plugin enabled (on Mac). It worked up until a few months ago, I presume something changed in the code or the discourse instance, but I couldn’t tell you when exactly. VSCode has certainly updated a billion times since then, too. As far as I can tell when I copy it, it’s just “regular” text. Not sure how to debug that though…