Hacker News | Ask HN: Anyone know how to publish code samples to Posterous?

All you have to do is surround your code block with the following tags:

your code here


Additionally, if you want to get fancy, you can specify a language with the following syntax:



public static boolean isAwesome = true;


This should work for both through the web interface and through the email interface.

The available list of languages is: 'cpp', 'c', 'c++', 'c#', 'c-sharp', 'csharp', 'css', 'delphi', 'pascal', 'java', 'js', 'jscript', 'javascript', 'php', 'py', 'python', 'ruby', 'rails', 'ror', 'sql', 'vb', 'vb.net', 'xml', 'xhtml', 'xslt', 'html', 'xhtml'

Current known issues: HTML formatting might be a little spotty at the moment. Will be fixing asap. I also see some intermittent errors where the code isn't getting properly recognized.

There you go! A quick and easy way to post code snippets to you Posterous - and you do not even have to edit the HTML. :-) I use this with all my coding posts.

Happy Programming!