Code4Blog is a Visual Studio 2010 extension that allows to convert any code supported by Visual Studio IDE to HTML format with the same structure and colors. Main purpose of this extension is to prepare a code snippet to be published in rich documents, for example in blog posts, Microsoft Word documents or Help files. Some additional styling could be applied: max width and height of the code block, custom background (per code line), font family and font size, line numbering and others. Code4Blog is now published onCodePlex. You are welcome to work with the source code directly! How to use.
Additional styling. You can apply some additional styling before export your code. To do this, go to menu Tools – Options. On the left part scroll down to “Code4Blog”. Here you can set maximum width and height (or leave it equal zero to make browser set it by default), background color for odd and even lines in Web format (meaning it should be a word, for example “Yellow” or hex number starting from #. For example #f4f4f4 set to light silver color) and other parameters. Then click OK and do re-export by clicking menu Tools – Save Code as HTML. Code4Blog Options Page: This snippet has been taken with following parameters: Width = 700, Odd lines color = #f4f4f4, Draw Border = Yes, Show Line Numbers = Yes: 1: /// <summary> 2: /// Default constructor of the package. 3: /// Inside this method you can place any initialization code that does not require 4: /// any Visual Studio service because at this point the package object is created but 5: /// not sited yet inside Visual Studio environment. The place to do all the other 6: /// initialization is the Initialize method. 7: /// </summary> 8: public Code4BlogPackage() 9: { 10: Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering constructor for: {0}", this.ToString())); 11: } 12: Blog |