Hacker News new | past | comments | ask | show | jobs | submit login
Ask HN: Anyone know how to publish code samples to Posterous?
34 points by swombat on Nov 17, 2008 | hide | past | favorite | 16 comments
I'd love to use Posterous as my main geek blog, but I can't figure out how to post code to it. A geek blog without code is like Santa without a beard. Anyone know how to achieve this feat?

If it's not supported, is that a feature you'd like to see on Posterous? Since Posterous is YC-funded, I imagine they'll pick this thread up, so let them know here if this is a feature you'd want (assuming it is indeed missing).




swombat, thanks for the suggestion!

Hm, I'll whip something up and post back here when it's ready (hopefully in the next hour).

====================

UPDATE: It's taking a little longer since I'd like to get some really slick syntax highlighting going. It's 3:25 am and I'm still recovering from a cold so I'm going to call it a night, but expect an update on the Posterous blog tomorrow: http://blog.posterous.com

====================

UPDATE 2: I couldn't sleep, so I kept working on it. I've just popped an early version of it live for you to try out. All you have to do is surround your code block with the following tags:

  [code] 
  your code here 
  [/code]
Additionally, if you want to get fancy, you can specify a language with the following syntax:

  [code lang='java']
  public static boolean isAwesome = true;
  [/code]
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.

Please report any bugs to me at garry@posterous.com. Thanks for all the support and ideas. Please do keep the feature ideas coming -- the best way to reach us is to email help@posterous.com, but voting up to the top of Hacker News works too. ;-)


Unbelievably fast. This sort of user response definitely sets you apart.


Sunday night is like ideal coding time!


Hi There,

does anybody know about a syntax highlighting web service which generates me full featured coloured html code, which can easily insert in my mail to posterous, so that is no server side stuff is needed?

Thanks,

Jan.


Brilliant, incredible, I'm amazed :-)

rushes to give it a whirl


[deleted]


How do you put a <code> in your email in Apple Mail?


I could use some feedback on this, actually.

I was thinking of just adding a [code] [/code] bbcode-like syntax for it, so you can totally still do it from email.

Otherwise if you're using the web editor in html mode you'll be able to throw <code></code> tags as usual to call into the CSS styles.

Definitely open to other suggestions too. =)


[code][/code] would be blisteringly simple...

Someone was mentioning on #startups that there's a google code javascript plugin to do syntax highlighting and automatically detect the language, etc...

Personally, if all it does is put the code in a dark background and monospaced font that keeps the tabbing/spacing, that's already good enough for me! Syntax highlighting would really just be extra sugar.



Thank you! That was exactly what I was looking for.


Can you just include markdown support for advanced users?


I like that too. markdown@posterous.com -- that kind of change is going to take a little more than an hour's worth of work, though... might have to wait til morning.


Incidentally, there's another huge vote for Markdown from this corner---for me it kind of takes posterous from the toy column to the essential column. Which is not meant as a slight to posterous; I think it's the most elegant blogging system out there, bar none. But a lack of some kind of structured text means that I'd be having to hand-code html in a mail window. And I promised myself I'm never going back there... NEVER.


Heh, swombat just really wants his <code /> tags but I just think markdown support would be natural progression moving forward.


Btw, using the html editor and adding <code> tags doesn't work too well as it messes up the spacings and/or line breaks :-(

(also has no default styling for the code samples)


Can you put in pre tags as well? Many people set white-space: pre; for code tags in CSS, but other people actually use code tags within text to distinguish they are talking about the function or programming construct error, not a specific instance of an error.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: