There are a couple of ways to display code snippets on a Blogger hosted blog.
1) GitHub Gist
Using
GitHub gist to write your code and embed it on blogger as so.
1. write your code and create a public gist.
 |
GitHub Gist |
2. copy the script tag that is for embedding a gist.
It should look something like this:
`<script src="https://gist.github.com/USERNAME/295f35b8e94d08ace93a1c2eafb0049f.js"></script> `
 |
GitHub Gist script |
3. Paste the script tag into the HTML of your blog post
 |
Embedding GitHub gist script |
4. It will appear like this:
 |
Embedded GitHub Gist |
1. You can first write your code on an Evernote note. To write a note on Evernote, you have use opening and enclosing ```. Check out my
Evernote review article if you haven't heard of Evernote.
```
code
```
Then you code will be wrapped in a grey box like so on Evernote in the image below:
2. Copy the the grey box that enclosing the code and paste it over to Compose section of a Blogger post. When you publish your article, you will see a grey box enclosing your code block like how it appears on Evernote.
Besides these 2 ways, I believe some developers have written some scripts that we can use to mark up code on Blogger but I haven't given them a try. Please let me know if you know some good ones.
Thanks for reading!
Jun
Comments
Post a Comment