Live Writer and sourcecode tag
When using the sourcecode tag with live writer, the code gets reformatted. Not sure if it’s an issue with Live Writer though.
In live writer, I create a test blog with the following text:
int i = 0;
When I post it (as a draft), I get the following text:
[sourcecode language='csharp']</p> <p>int i = 0;</p> <p>[/sourcecode]
Is this something that can be fixed?
This is something that staff need to attend to. You can contact them on weekdays between 9-5 PM using this link http://wordpress.com/contact-support/
the only workaround, currently known to me, is to switch into ‘HTML view’ and paste your code into desirable place.
to PREserve indents, you may definitely want to wrap a whole snippet, including .com [sourcecode] tags, into PRE element tags.
There’s a great plug-in for Live Writer (that I use) that copies code from Visual Studio and uses your own coloring and highlighted from VS.
The downside is that it embeds the HTML coloring styles into your HTML code, so you lose a little bit if you ever want to scale up to your own blog and use a better WP plug-in.
btw, regarding WLW plugins. there’s another great one from Joe Cheng, a software developer on the WLW team.
I imagine there will be no hassle (just a couple of clicks) to make a dynamic-template, which would sourcecodify (well, rather HTMLize in fact) a code snippet in the way I suggested above, utilizing .com [sourcecode] tags.
so, later when you’ll want to use a better WP (or whatever better) plug-in, all you will need is just to grep ‘[sourcecode]‘ pairs from WXR file, and your code will be clean (from the messy spans) *and* formatted (preserved indents) as well.
The topic ‘Live Writer and sourcecode tag’ is closed to new replies.