DEV Community

Hemanth Varma
Hemanth Varma

Posted on • Edited 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 https://gist.github.com.
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 https://gist.github.com/akhilanandbv003/fd4f3898bb7b9c36f7b9a8c198e01548 ```

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

Hope this helps!

Top comments (0)