One thing that every Github user should know 💯

Madhu Sri Sushmitha Chowdary
2 min readNov 20, 2020

When I started writing articles, I thought of writing some of the programming articles for which we need a coding block which separates the code from the main content. Then I came to know the feature provided by Medium which helps to integrate our code with GitHub. So, let us learn how it works….

Step 1: Press Ctrl + Alt +6 at a time a separate block is created

Write your desired code to be written in block. It will be viewed as shown below….

#include <bits/stdc++.h>
using namespace std;
int main(){
int a,b;
cin>>a>>b;
int sum = a + b;
cout << sum <<endl;
}

For the above block we can’t get the highlighted keywords for the selected programming language.

So in order to get the highlighted keywords for the selected programming language.

3 Steps to Embed code block into your article

Open GitHub https://github.com/login and login to your account.

Step 1: Beside your profile icon, you will find + option and click on the drop down you will find New Gist. Click on the New Gist

Step 2 : In the next page give the Gist Description if required then give file name including extension. In the below block write the required code. Later click on Create Public gist to make it visible to all, else make it Private gist.

Step 3: After creating Public Gist, Click on share. You can find the link next to share button and copy the link and paste it in your article and press Enter.

Finally, we are done with embedding our code which separates from the main article.

Now you can start writing your articles where you can include your code…..

Enjoy writing articles 😁😁

--

--