Extra spaces added to markdown with rich text pasted

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:

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