Web Applications Stack Exchange is a question and answer site for power users of web applications. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Possible Duplicate:
How to post source code in Blogger?

I try to blog in blogger.com.

it's ok for text and images, but every time I want to put source code, it's a pain...

Here in stackexchange is so easy to post code!

   works();//Hello I am a source code

But definitely blogs platforms aren't (still) ready ​​for source code.

Does anyone know a sane way of of blogging formatted text + source code ?

PD: meta feature request... stackexchange blogs!!

share|improve this question

migrated from superuser.com May 14 '12 at 21:18

This question came from our site for computer enthusiasts and power users.

marked as duplicate by Al E., Alex, ChrisF May 17 '12 at 14:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

The most basic form is just wrap your code with <code> tags. If you want somthing more fancy, you can use http://codeformatter.blogspot.com/. Just paste in your code beforehand and it will give you the HTML to paste on your Blogger page. It gives nice effects like alternating color lines and line numbers.

For example your example, using the defaults becomes

<pre style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;">
<code style="color:#000000;word-wrap:normal;">

    works(); //Hello I am a source code

share|improve this answer

If you want to have similar result as in StackExchange sites, use Google Prettify. This is exactly what is used here.

share|improve this answer

You haven't actually told us what is painful.

Is it the lack of shading? Or is it the fact that Blogger tries to interpret HTML (and HTML-like) commands in the code.

If it's the latter, then a very simpley solution is just to turn of the interpretation: it's an option under the Post Options settings in the post-editor.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.