Add Code Snippet To Blog Post Using Github Gist

github

A Gist is a snippet of code hosted by
Github. it has all the benefits of a
Github repository, but provides them
to you in a most easy way. Public Gists are free to create and
store on Github. They are likewise super
easy.
You can create a new Gist, add,
modify, and delete files and code
entirely in the browser. You don’t
need to install or download anything.

last time I wrote about how you can add code snippets to your blogger blog posts using syntaxhighlighter. Today, I will be exposing to you how github works for blogger and other blogging platforms when it comes to adding code snippets.

Below are the steps

  1. Sign up with github if you haven’t, then Log in to site.
  2. Click the Gist link at the top of the
    screen or visit gist.github.com
  3. Fill out the file name
  4. Enter your supposed code
  5. Click Create Public Gist

 

Note: The syntax highlighting auto-
detects based on the extension of the
file name that you enter, so be sure
you add the appropriate level of detail.

Now that you have created your gist, you need to embed it.

github

Once you create your Gist, you will land on a page which displays your code.
Copy the embed link and paste the script tag on to your website.

and that’s all.
make sure your paste the script tag in the html view of your post editor…
To edit any code you’ve written, go to your github gists and edit.

Leave a Comment

Your email address will not be published. Required fields are marked *

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.