Sunday, March 6, 2011

How to embed code snippets in blogger

Blogger.com (this blogging service) is terrible for embedding code.  Everything gets mangled, double-spaced and mis-formatted. Just terrible. But there is an answer to code snippet embedding: Gist.

Gist is a free service run by Github, the open-source project hosting service. Gist allows you to post code snippets share them via a unique URL, and even allows for comments. Just go to The Gist Website, paste in your code, give it a title and description, then click "embed" and copy the link. You can paste the link into your blog, and (using javascript) it will embed an un-mangled code snippet, just like this:


No comments:

Post a Comment