My dear coding addict, once you've made some code snippet you'd like to share. You've posted it, and saw that formatting is crap. Literally, there's no formatting. Thanks G-d, you've read W3C papers and know, that there is a <pre> tag, so you wrap your beloved snippet with tags, look at result and see that there's no highlights. Now it's time to
google.
Google will show you several results, which you could even like and use. But the point is that most popular solutions for this task require some massive JavaScript code and serious regular expression job to be done at client side, to replace monotone text with all that fancy coloured pieces. Don't know what about you, but I don't like such solutions.
There's also several specific off-line libraries to do highlighting for you, which I don't like either.
What to do? The answer is simple: DRY, why repeat job already been done with your favourite text editor? Go on and install
htmlize.el (for me, Debian addict, it worked by typing
sudo apt-get install emacs-goodies-el). This piece of magic extracts current colour scheme from your system and creates an HTML code with appropriate highlights. Having a code snippet in buffer, just type
M-x htmlize-buffer (or
htmlize-region if you want to htmlize just a piece of buffer) and Emacs will pop up a buffer with 100% pure, ready-to-use HTML code, with separate CSS and all that fancy things. If you, just as I do, plan to paste lots of code, simply put code styles to your blog template and that's it. After that you'll just need to copy-and-paste HTML.
God bless Emacs!