Live Writer and sourcecode tag

  • Author
    Posts
  • #158528

    tjoe
    Member

    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:

    [sourcecode language='csharp']

    int i = 0;

    [/sourcecode]

    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?

    #158635

    timethief
    Member

    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/

    #158695

    options
    Member

    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.

    #158710

    jamesewelch
    Member

    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.

    homepage:
    http://11011.net/software/vspaste

    download:
    http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&l=8

    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.

    #158712

    options
    Member

    btw, regarding WLW plugins. there’s another great one from Joe Cheng, a software developer on the WLW team.

    http://jcheng.wordpress.com/category/windows-live-writer/dynamic-template/

    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.