Sunday, October 19, 2008

Paste formatted C# source code into blogger posts

I recently found a very good online tool that allows C# (and other) source code to be pasted into blogger posts as formatted and colorized text: C# code format.

It is very simple to use:

  • copy source code from your IDE (like VisualStudio)
  • paste source code into the source code box on this website:
  • click on "format my code" button
  • click on the "select all" button
  • copy the HTML code
  • go to your blog post
  • switch to HTML mode (click on "Edit Html" tab)
  • paste copied HTML code

There is one more thing you should do. Either add a link to "csharp.css" file (the file is available for download on the website) to template of your blogger blog or select "embed stylesheet" option before clicking on "format my code" button.

NB: You should be able to use the same tool with other blog engines or any other HTML pages.

1 comment:

Anonymous said...

I recently came across your blog and have been reading along. I thought I would leave my first comment. I don't know what to say except that I have enjoyed reading. Nice blog. I will keep visiting this blog very often.