Critical Development

Language design, framework development, UI design, robotics and more.

A Workaround for Poor Formatting and Copy-Paste Behavior of Code on the Web

Posted by Dan Vanderboom on March 22, 2008

I bought BlogJet for publishing my blog articles, and have struggled with it (sometimes for hours) to get the formatting right, or as close to it as possible.  Sometimes I can paste code in it from Visual Studio (to get the color-coding perfect), and other times the color or indentations won’t transfer.  Invariably the way it looks when published doesn’t represent the way it looks in the editor itself.

Maybe BlogJet just sucks and there is a better option!  With this idea in mind, I downloaded and started using Microsoft Live Writer, which is free and part of Microsoft Live Services.  At first I was very happy with it, but soon I realized that it had many of the same problems as BlogJet.  What are they doing, copying each others’ bugs?!

So I’m on the lookout for an exceptional blog publishing software package.  I’d like to manage categories through it (add, edit, remove), maybe read comments, or at least be able to have an accurate and reliable WYSIWYG experience.  If you know of any, drop me a line.  I’m willing to pay a premium price for a good thick-client article authoring environment.

In the meantime, I’ve discovered that I can usually get around the source code problem by copying the code first into Microsoft Word, and then copying it from Word and pasting into the blog software.  No extra lines, indentation, or color problems so far have occurred with this technique.  Why does this work?  I have no idea.

Also, if you’re copying code from a webpage such as my blog, and pasting it directly into Visual Studio (or the Macro editor), you’ll notice blank lines between lines of code.  If you care, the same trick of copying to Word, and copying from Word to Visual Studio, will steer you around this annoyance.

3 Responses to “A Workaround for Poor Formatting and Copy-Paste Behavior of Code on the Web”

  1. Hey,

    I’m a developer on the Writer team. Sorry to hear about the problems pasting source code into Writer. One thing you could try is a few of the Writer plug-ins that are out there that solve just this problem! Here are a couple you might check out:

    http://gallery.live.com/liveItemDetail.aspx?li=d4409446-af7f-42ec-aa20-78aa5bac4748&bt=9

    or

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

    Good luck and sorry about the problems!

    Best,

    Charles

  2. Dan Vanderboom said

    Hi Charles,

    Thanks for the tip on the code snippet add-ins. It bugs me a little to have syntax colorizing not get all the colors right, as happens with the CSS methods of doing this, but it’s even more of a headache to find myself unable to paste code at all, lose my formatting, or some of the other bizarre behaviors I’ve been encountering. So I’m going to try one or both of these out and see how that goes. The formatting problems I’ve seen with Live Writer and BlogJet seem to be global, however.

    Specifically with Live Writer, these are the biggest pain points.

    1. When writing the long Tree article, after publishing a few times and reloading it, I would apply a text style like “Heading 1”, and it would send the cursor back to the top of the article every time. I tried repeating it on a new blog post and couldn’t, but as soon as I publish it and try applying a format, I can repeat the misbehavior. It’s very frustrating if you’re trying to apply text formatting to many parts of your text.

    2. Forcing text to be the correct font and size is very difficult. Sometimes when you apply a font to a paragraph, it seems to completely ignore the command. This happened especially when pasting in source code, which is in Courier New, and then trying to insert lines and make them a different font.

    3. Many times when go to Format–>Font, no font size is selected to indicate the current font. I don’t know if the text is just a different font size that isn’t recognized in the list, or if the program forces it to be a valid size and just fails to indicate which one it is in the list, or what’s going on.

    4. When attempting to change fonts without using the predefined styles, having to keep opening the Format–>Font menu is really inconvenient. The font name, size, and text color should all appear on the toolbar for fast access, as they are in Word.

    5. Vertical spacing can be strange, which I assume is due to HTML not liking blank lines. In the Live Writer editor, I added an indented section (by hitting Tab), and a title followed by a blank line and then some text, and the blank line disappeared.

    Other than those things, I do like it. Especially the ability to add categories (couldn’t figure out how to do that in BlogJet).

    I read your blog article on Live Writer being used for Graffiti CMS, and I think that’s a really cool idea. I’m a 100% thick-client developer and have never liked HTML or web development, so using a thick client to manage the content of a website is very appealing to me. Do you think it’s possible that Live Writer could expand to include more CMS functionality in the future? I don’t know what kind of web CMS protocol standards there are that would extend or complement Atom, RSS, and so on, but it seems like a great direction to go.

  3. I am looking for some good blog posting software also. I currently use Blogjet and haven’t had too many problems, but sometimes the displays get messed up. I’m also looking for a way to make nice looking tables to put in a WordPress blog. My understanding is that pasting MS Word stuff into a WordPress blog can cause problems. Maybe if you post it to Blogjet first, that gets rid of some of the MS Word formatting that causes these problems.

Leave a comment