How to add code snippets to Medium?

Squirrel
1 min readOct 30, 2016

--

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.

https://gist.github.com/neotheicebird/bd7bdb47b8e4d424d163.js

--

--

Squirrel

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