How to include code in Posterous

So the first question I have is how do you publish code samples in Posterous (the blogging software I use)?

First link I’ve found in looking for this is: http://blog.posterous.com/announcing-markdown-support. According to the site, <markdown> will highlight the syntax of the code I publish according to the code language I provide. 

That sounds nice if it actually works. Which after many tries with the strict 4-space or 2-tab indents, I couldn’t get to work. So much for <markdown>.

Posterous does provide a link to an alternative though – Github Gist (http://gist.github.com/). Now, this site is cool. Simply select the language in the pull down, type a description & paste your code. Then click on “Create Public Gist”. It will create a file and publish to a public repository (or private if you elect to do so). 

It will also give you the ability to embed the sniplet via a java script link. To do this in posterous, switch over to the HTML editor and paste it in. As such:

 

Update

Posterous now supports a one-lined http entry so you don’t have to use the html editor. See http://blog.posterous.com/posterous-now-supports-traileraddict-embeds-a for more information.

Leave a Reply

Powered by WordPress.com.

Up ↑

%d bloggers like this: