DEV Community

Hemanth Varma
Hemanth Varma

Posted on • Updated on

Add code to your medium article GitHub Gist

A quick way to insert code for your medium stories.
Easiest of all is to embed your code

. This allows embedding your code as :
//Your code
def hello_world():
print('hello world')
Make sure you press enter so that you see the below symbol before you start typing

But this approach would get tricky if you are embedding code which needs an indentation. Hence we can use Github gist.
Go to
Add your code in the gist.
On your top right you will see the

  1. Click on Embed drop down and select Share , this should give you an url something like ```

Paste it in your article and press enter. Hazzaaa!!

Hope this helps!

Top comments (0)