views:

231

answers:

3

Hello everyone,

Could someone give me a link, a tutorial or an already made css template for styling code snippet to add that feature to my blog ?

I seen examples in numerous blogs, but, now that i am searching for one, i can't put hands on it !

I want to be able to post a code snippet with keyword coloration, line numbers etc..

Many thanks in advance.

EDIT : i know there are some solution like prettify (thanks Developer Art) or SyntaxHighliter but i am on a platform and i can't use Javascript

+1  A: 

Prettify is what you're looking for.

You include a bunch of JavaScript and CSS files to your pages and mark page sections that need to be prettified. Pretty much it.

Developer Art
that's cool, i must say. But i can't embed JavaScript in my blog, i am on a platform.
Maxime ARNSTAMM
A: 

There are server side solutions for this as well, which of course depend on your server language. PHP is the ever popular choice for blogs, in which case you could use the equally popular GeSHi library.

Ryan Lynch
+2  A: 

manoli.net offers an online copy/paste syntax highlighter:

This tool allows you to format your C#, VB, HTML, XML, T-SQL or MSH (code name Monad) code for publishing on a web site or in a blog.

The output conforms to the HTML 4.01 specification and is color-coded to make it easier to read. The colors can be changed by modifying the CSS style sheet. See a sample.

And you may want to check out the Syntax Highlighter project on CodePlex (not sure how much activity it still has, though):

Syntax highlighter converts code text to HTML where common language elements are formatted using style sheet classes such that the coloring scheme can be switched or altered as simple as replacing a CSS file. The primary release ships as an extension for BlogEngine.NET.

Metro Smurf
manoli is great, it gives me the css/html and it works well, thanks.
Maxime ARNSTAMM