How to add code snippets to Medium?

The first thing I searched for before writing my first article on medium is to find out how to add code snippets to my articles.

So how to do that?

Like this.

Hehe. Ok, I am being serious now, You can get the gray box using

Ctrl + Alt + 6 

for Windows user, and Mac users, your option is to alternate the ```Alt``` with ```option``` (A nerdy play of words)

Cmd + Option + 6

I know what you are thinking. Concrete blocks are gray, code blocks aren’t just gray, they have colors. And the cure is syntax highlighting.

Apparently there is no simple support for highlighting syntax, so we have to depend on Gist

Simply paste a github gist link in your article it Automagically turns in a code snippet (with colors). Yaay.

Codes in python. Rants about ML and stuff. Trains to be a coding superhero.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store