Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Formatting code snippets for blogging on Blogger [closed]

My blog is hosted on Blogger and I frequently post code snippets in C / C# / Java / XML etc. but I find the snippet gets "mangled".

Are there any web sites that I could use to parse the snippet beforehand and sort out the formatting, convert XML "<" to "&lt;" etc.

There are a numbers of questions around this area on SO but I couldn't find any that address this question directly.

Edit: For @Rich answer, site states "To display the formatted code on your site, you need to get this CSS stylesheet, and add a reference to it in the <head> section of your page". That's the problem - you can't do this on Blogger AFAIK.

like image 209
rbrayb Avatar asked Mar 24 '09 20:03

rbrayb


People also ask

How do I add a code box to my blog?

Method 1: Add code box using HTML code Step-1: Copy the below code and paste it into the HTML section in the Blog post editor of Blogger. Step-2: Now Switch the editor to compose view and replace the text with the code and save the draft as shown in the below screenshot.


1 Answers

I've created a blog post entry which explains how to add code syntax highlighting to blogger using the syntaxhighlighter 2.0

Here's my blog post:

http://www.craftyfella.com/2010/01/syntax-highlighting-with-blogger-engine.html

I hope it helps you guys.. I'm quite impressed with what it can do.

Above Links stopped working. Try using http://hilite.me/

like image 118
CraftyFella Avatar answered Sep 28 '22 10:09

CraftyFella