Saturday, May 12, 2012

Copy & Paste Code from Visual Studio to Blogger

Just set up my blog to share my experience of building social CRM in the Cloud using Windows Azure, SQL Azure, ASP.Net MVC and jQuery.

Many of the posts will have code snippets from Visual Studio, SQL Management Studio etc. dev tool, so I was wondering how I can preserve the HTML formatting of the code during copy & paste.

A quick search yields two solutions:
- Visual Studio Productivity Power Tools.  The traditional VS editor only copies the plain text and RTF formats to clipboard.  After installing this VS 2010 extension and restart VS, pressing Ctrl+C will place the formatted and colorized HTML fragment on clipboard.  Then you can paste it to Blogger or other HTML editor while keeping its format.  I tried it and it works like charm.
- Using syntaxHighlighter JavaScript library:  David Craft explains how to do this in this blog entry.

Happy blogging! :)

No comments:

Post a Comment