Showing posts with label format. Show all posts
Showing posts with label format. Show all posts

Monday, October 26, 2009

C# Code Formatting Using Blogger Stylesheet

You can include the styles for the code formatting in the main stylesheet.

Adding the style

Select Dashboard > Layout > Edit Html.

Scroll down to or find the stylesheet closer, ]]></b:skin>.

Insert the following style before the stylesheet closer. It should like the below.  

     .csharpcode pre { margin: 0em; }
     .csharpcode .rem { color: #008000; }
     .csharpcode .kwrd { color: #0000ff; }
     .csharpcode .str { color: #006080; }
     .csharpcode .op { color: #0000c0; }
     .csharpcode .preproc { color: #cc6633; }
     .csharpcode .asp { background-color: #ffff00; }
     .csharpcode .html { color: #800000; }
     .csharpcode .attr { color: #ff0000; }
     .csharpcode .alt
     {
         background-color: #f4f4f4;
         width: 100%;
         margin: 0em;
     }
     .csharpcode .lnum { color: #606060; }
     ]]></b:skin>

Editing a post

Goto http://www.manoli.net/csharpformat/ and paste your code in the box provided. Untick embed stylesheet and select format my code.

On your post Select Edit HTML and paste the html code of the formatted code in your post.

Sunday, October 25, 2009

C# Code Formatting

You can use this service to formatting your code to html. Great for using in a blog.

http://www.manoli.net/csharpformat/.