Meta 2: Pasting Code In WordPress

Who knew blogging had such a learning curve?

Today I’m just trying to paste code in my blog and have it look like maybe something that a fellow programmer might attempt to read for any reason other than pity. Personally I can’t stand code that’s been formatted into a pretty, proportional-width font. It feels like trying to use Microsoft Word as your IDE.

Frankly I can’t imagine anything more terrifying. So to spare myself that embarrassment, let’s give it a shot by heading to the only post editor on the WordPress site that isn’t likely to leave us tearing our hair out in frustration.

Username [Hover] Blog Name [Hover] New Post

My first instinct was to invoke the “Kitchen Sink” (Yes it’s really called the Kitchen Sink) and use “Preformatted” line styles for my code, but that just won’t work.  In fact, it’s completely awful! Every newline becomes a new preformatted code block separated by a white margin. You can remove the white margins between lines by deleting the newlines and then adding them back in with the return key, because that makes a lot of goddamn sense, but there doesn’t appear to be any other easy way.

But wait, I notice another option: “Visual” and “Text”, on the top right of the post editing area. These two tabs aren’t present on the other, weaker “New Post” sections.

In “Text” the editor is all fixed-width and formatting tags are visible. Amazingly, there’s a code button!

@interface ViewController : UIViewController {
NSString *state;
}

Wow. That doesn’t look half bad.

WordPress might be usable after all…

Advertisements

Metablogging

OK, I’ve already tried to do two posts and both have been lost because of a terrible web-based editor on WordPress. So now I’m going to post about WordPress, because you can always metablog about blogging.

From the “New Post” header at the top of the WordPress site the editor seems to be wretched and lacking support for autosaved drafts, both things I despise. Same if you “Pop Out” the “New Post” window, though it looks like it might be slightly less wretched if only because it exists in its own floating window.

However, from the UserName [Hover] Blog [Hover] Add New link there appears to be more features and notably I see an “autosaving drafts” feature. Which is good because, you know, some people might not like to lose their work all the time.

Oh, WHY GOD WHY does Google Chrome think that it would be logical if the backspace key functioned as a Back Button when there are editable text fields all over the screen that I’ve like, you know…been typing in?

Terrible. Oh well, guess I finally have a need to use Safari. I think I have found out The Right Way to blog on WordPress.

Next time I will see if I can figure out how to post code in a WordPress blog.