It seems that the last several blog posts, I’ve fought with LiveWriter as it would butcher any code that I tried to paste in. The frustrating part is the code looks formatted in LiveWriter, but when it posted, it would be all-kinds of messed up. If I Open the blog post back into LiveWriter, it continues to format correctly in Live Writer, but looks messed up on the web page. Very frustrating.
I decided to get to the bottom of this, as it frustrated me every time!
In Live Writer, under the “Insert” ribbon, there is a “Add plug-in” option:
I clicked “Add plug-in” and first tried the “Insert code” plug-in. That did not work. It rendered out the CSS to format the code, as in-line text.
I next tried the Code Snippet one. That too butchered the format. However, this one had more options. I realized that if I “embed” the styles, that seems to work (actual example below):
/// Example XML code comments.
/// <param name="someArgument">An important argument.</param>
public void TestMethod(String someArgument)
Int32 value = 123;
I even have some additional options (actual example below):
So the bottom line is, if you’ve been fighting with Live Writer and formatting Visual Studio code, check out this add-in for Live Writer:
Then, make sure to at least set the “Embed Styles” option: