Creating code examples

Topics: ASP.NET 2.0, Controls
Sep 25, 2007 at 2:25 PM
Hi

Just wondering if it is possible to create color coded examples in the new version? How do those who blog about e.g C# create there examples code (without taking screen shots!)?

Sowokie
Sep 25, 2007 at 3:02 PM
I found one! http://www.manoli.net/csharpformat/ But unfortunately he doesn´t have the css that color/format the code!! Any one know about something else?

He suplies the sourcecode for the converter. Maby someone could implement this into the blogengine? :-)
Sep 25, 2007 at 3:36 PM
Edited Sep 25, 2007 at 3:36 PM
In the never sources, and in 1.2 i believe that is already implemmented, i'm using it on my blog at the moment. use [code:c#][/code] around your examples. Remeber to copy the css from the Standard theme css file to your themes css.
Coordinator
Sep 25, 2007 at 5:35 PM
It is in the 1.2 release for c#, html, xml, javascript, sql and vb.net. We'll make sure all the themes will have the right CSS before release.
Sep 27, 2007 at 7:53 PM
In the meantime, just copy this code into your theme of choice:

/* code styles for CodeFormatter Extension*/
.code
{
font-size: 12px;
color: black;
font-family: Consolas, "Courier New", Courier, Monospace;
background-color: #F1F1F1;
/white-space: pre;/
}
.code span{
line-height: 14px;
}
.code .rem { color: #008000; }
.code .kwrd { color: #0000ff; }
.code .str { color: #006080; }
.code .op { color: #0000c0; }
.code .preproc { color: #cc6633; }
.code .asp { background-color: #ffff00; }
.code .html { color: #800000; }
.code .attr { color: #ff0000; }
.code .alt { background-color: #f4f4f4; }
.code .lnum { color: #606060;}
Mar 17, 2008 at 1:47 AM
I'm trying to use this and it flattens out the code when I use the actual CSS stylesheet by Manoli. Is there a button on the toolbar to use this feature, if so I can't find it.