How to add code in your Medium Blog
Published in
1 min readOct 30, 2016
Writing this down because I keep on forgetting. Right now, there are two ways to right code in your medium blog.
USING COMMAND-ALT-6 for MAC or CTRL-6 for Windows
- Highlight the necessary text that is your code snippet
- Type Command-ALT-6 for MAC or CTRL-6 for Windows
RESULT:
//hello, this is my code.
USING Github Gist
You can now embedded Github Gist on your Medium Blog.
- Have a Github Account. It’s Free.
- Go to https://gist.github.com.
- Create a New Gist. Add a description if you want, add the code snippet that you want to share then publish it whether it’s a secret gist or public gist. It will both work.
- Copy the URL of your gist.
- Paste it here on Medium then press enter. If you didn’t press enter, it will only show your gist URL and not the Github gist.
Example #1: Paste it in Medium without pressing enter — result: Gist URL
https://gist.github.com/michieriffic/0ff84bee16cbeec029a9d5aaee1fc0e5
Example #2: Paste it in Medium and pressing enter — result: Github Gist
If you enjoy this quick tip, you can give it a ❤ or share it out. Thanks! :)