0

I wonder why when I typed 3 back ticks (`) and then use CMD v (on the Mac) to paste some code into Medium, all the indentation / spaces are lost. I have to manually add the spaces back and indent every line.

The same issue with CMD Option 6 on the Mac.

Is there a way to make it work?

Usually, we have the code in the programmer's text editor such as Sublime Text, Atom, or Visual Studio Code, and we copy the code there and paste it to Medium. To make it better, we usually press CMD [ (open square bracket) to reduce the indentation level so that the first line is not indented at all. And then we copy and paste to Medium. But Medium doesn't take the spaces.

1

I'm using Windows and following trick helps me:

I copy text from IDE/editor and paste it into standard Notepad application, then copy it from Notepad and paste it into Medium.

Probably using TextEdit on Mac could help with disappearing spaces on a Mac.

However, I would suggest using GitHub's gists because it looks much more stylish than standard Medium's code styling:

Standard code block: standard code block:

Embedded gist: Embedded gist:

-1

To paste code in Medium when on a Mac use the following shortcut:

CMD + option + 6

1
  • right, and then you paste the code and all the spaces are not there – nonopolarity Feb 19 '20 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.