Embed GitHub Gist in Medium

Pirix Technologies
2 min readJul 7, 2020

Embedding code to Medium has 2 means: use markdown style ``` or GitHub Gist. I’ll quickly explain both below.

Markdown Style

For smaller code snippet, this method is the easiest and most efficient, a general rule I found through trial and error is this method works best for code snippet less than 10 lines, and without much indentation.

def main():
print("hello world!")

if __name__ == "__main__":
main()

GitHub Gist

To embed GitHub gist, Medium made it super easy.

  • On the top right corner, click Embed button and select Share
  • Copy the share link and paste in Medium blog post
  • PRESS Enter!!

The last step is super important since otherwise the blog post will show just the link without Medium automatically rendering the embedded link.

Conclusion

I prefer GitHub gist method because it’s more flexible for change and more suited for developers habit (we tend to be around in GitHub more)

References:
Medium Official Blog

--

--

Pirix Technologies

We provide cloud computing and software development services to our clients