Wednesday, 30 September 2015

How to Format Source Code in Blogger

I had a problem embedding code snippets and inline code examples to my blog. I surfed and found a simple solution as below:
    1. Create an account on github.com
    2. After logging in to github, click on Gist
    3. Add a file-name with an extension (extension will be used to add syntax highlighting)
    4. Add your code snippet which need to be added to your blog post
    5. Click “Create Public Gist” button at the button
    6. Click on the “embed” link and copy the script generated


      This is all from Gist side. Now to Blogger,

      1. Paste the script where you need to add the code snippet
      2. Make sure to select the option “Interpret typed HTML” under Post Options -> Compose Settings

No comments:

Post a Comment