Retain line breaks inside TextArea for use with syntaxhighlighter


  • Live Writer is the best blogging software I have found, but there is one thing that really bugs me. I use SyntaxHighlighter and precode to create code blocks blocks, and every time I add the code block to Live Writer it removes all the line breaks and merges the code into one long string. I have it setup to use <textarea class="brush:python" rows="123" cols="80">...</textarea> so that users without javascript can still view the code in a textbox (SyntaxHighlighter converts these blocks into code blocks). It looks fine when I paste it into the source tab, but then when I change to the Edit tab it reformats the text inside the textarea, changes the rows attribute and removes the cols attribute. I end up having to manually update the post from the blogging website after it is posted. Is there any way to get Live Writter to not change the text inside the textarea tag and to not change the rows/cols attributes?
    Saturday, February 20, 2010 12:36 AM

All replies

  • It sounds like Windows Live Writer is trying to 'out think' you.

    You can use a nice little tool called Dynamic Templates. I really suggest you go to the website and watch the videos to get the real idea of the plug-in.


    You can do other things too; it's quite configurable to various things Windows Live Writer doesn't do by default.

    I use this to INDENT text:
    <p style="margin-left:.5in;text-indent:-.5in"><br /><%= _selection %></p>

    BUT you could use this as well, but replacing the PARAGRAPH tags with CODE tags.

    Download here:

    Hope this helps.

    Saturday, February 20, 2010 2:21 AM