Markdown copy/pasted into the editor used to format, no longer does?

I prefer to write blog posts using Markdown in VS Code, then copy/paste the Markdown into the Ghost editor. When I first started using Ghost the entire editor was just Markdown (that’s what got me to switch to Ghost) and so this was no problem. When the editor was overhauled recently, it was no longer pure Markdown but if I copy/pasted Markdown into it, it would format correctly so still no problem. But recently I’ve noticed that although Markdown that is typed in the editor formats correctly, Markdown that’s copy/pasted isn’t. Here’s a screenshot of some code that was pasted in from VS Code:

So it’s kind of formatting correctly but it’s leaving behind all these artifacts, like the double-asterisk around the bolded stuff, that I have to go delete once it’s pasted.

Is there something I can be doing differently to get Markdown from the clipboard to format correctly when it’s pasted?

I know I could just create a Markdown block and use one block for the whole post, but I’m not a fan of that because double-clicking on text that needs to be edited opens the block and puts the cursor all the way at the beginning, rather than where you want to edit.

  • What’s your URL? rtalbert.org

  • What version of Ghost are you using? 4.8.4

  • How was Ghost installed and configured? Digital Ocean

  • What Node version, database, OS & browser are you using? Chrome 91.0.4472.114

It’s specifically a VSCode problem. The default copy in VSCode does not copy plain text, instead it copies html with syntax highlighting which means when pasting into Ghost’s editor it pastes as html which then gets formatting stripped to match the formatting that’s supported in-editor.

You can change the behaviour by setting editor.copyWithSyntaxHighlighting to false in VSCode. I think you can also assign different copy behaviour to different shortcuts and there are addons which provide functionality that can help.

2 Likes

That worked – thanks!