Extra spaces added to markdown with rich text pasted

Not sure if this is intentional / necessary for Markdown related reasons, but just noticed when I pasted some rich text into the composer, strings with formatting (bold / italic) seem to have extra spaces inserted before and after the * or ** tags.

See example here e.g. the URL in the quoted text or the bolded **SPRING2019** near the bottom.

The quoted text above was copied from a web page; the below “sale” text copied from an email. Not sure if this always happens but at least two sources where I’m seeing it.

3 Likes

This bug has existed for quite a while @vinothkannans I’ve noticed it many times.

10 Likes

I’ve tested this issue pasting text copied from email (Gmail), Google Docs, Microsoft Word, and ordinary HTML webpages – all these content sources lead to extra spaces being added around bold and italic text. Inline code blocks also have extra spaces added, but strike-through text does not. For example, if I paste text off of my website into the editor, here’s what happens:

image

image

Since the automatic conversion into WYSIWYG Markdown is so handy, I’ve found myself pasting into the editor and then using a regular expression in a different program (e.g., Vim, Notepad++) to remove the extra spaces, and then pasting back. It’s a bit hackish, but still easier than saving a file and using Pandoc to get the Markdown.

So long as adding the spaces isn’t somehow required for RTF/HTML pasting, it would be a good thing not to add them, right?

6 Likes

This is now fixed per:

https://github.com/discourse/discourse/pull/11130

:confetti_ball:

6 Likes