How I Write Blog Posts

This is how I’m going to start writing blog posts.

vim on the left, Marked on the right
vim on the left, Marked on the right

The Problem With WordPress

Annoyingly, WordPress has lost a few of my posts now because it doesn’t really act as I would like it to.

Over the holidays I was at my partner’s parents’ house, and was happily typing away on my laptop. I’ve been writing up my findings of the web sockets “game” which turned into a fairly lengthy blog post (still working on it!). I was pretty happy that WordPress was occasionally telling me that it was auto-saving once in a while. I get called away for dinner, so I just close the lid of my laptop.

My state really should be saved at that point, right? That’s what you expect when you leave your computer – for the stuff you had on the screen to still be there. Unfortunately, that’s not what happen. I came back to the session expiring in WordPress, so I had to log in again. I went to find the draft post I was working on but it was missing a couple of paragraphs.

Thinking that auto-saving every few minutes is enough is just not cutting it. Every character I type is important, and each character I type should be saved. That might not be economical to do with AJAX though, so I can understand why WordPress avoided that solution. Similarly, localStorage isn’t good enough yet (at least that’s the last I heard of it).

Despite finding the WordPress writing UI really pleasant, this is fatal flaw that I can’t live with. The possibility of losing massive chunks of work is too high.

Using Vim and Marked

Whenever I’d write in WordPress I’d almost always use the Distraction Free mode – it strips out all of the UI, and leaves you with just a blinking cursor and the words “just write.” There are still some distractions with it however: my tabs for one thing, Facebook blinking at me telling me I’ve new messages.

vim on the overhand literally just has a blank, black screen and lets me type.

Of course, I could just use Notepad (or whatever OS X’s alternative is), but the opportunity to spend more time in vim is exciting for me. With IDE’s I’m using at work getting more bloated, the slim line text editor is looking more and more appealing, so I’m happy to be getting more experience. It’s true that coding and writing are different styles of keyboard usage, but being more comfortable with it can’t be a bad thing.

I like the idea of having most my posts’ content backed up outside of WordPress, in normal text files, too.

The problem, you might bring up, is that I lose the WYSIWYG editor. Not to worry though! I have Marked for that. Marked basically watches for changes in a file, and then renders the markdown for it. I love this. You can’t use Markdown in WordPress, which is a shame. Markdown really makes styling easier since I never have to reach for my mouse to go to some button to make the highlighted text into a link. I just wrap it in brackets, or add some asterisks for emphasis.

Typing code in WordPress was dire too. Going into the source view, wrapping <pre> tags around things (which WordPress would inevitably muck up). I don’t want to see HTML when I’m writing, I just want to write.

Getting it into WordPress

This is pretty simple too. Marked lets me copy the HTML of the view it’s rendered, and I just paste that into the source of the WordPress editor.

I do have to manage adding images into the posts within WordPress, but that’s not a bad experience at all.

Dash Before Caption in WordPress

There’s a dash that goes before the caption in WordPress posts. Most people want to remove it, according to my Googling. I wanted to use it in another theme I’m working on.

The relevant piece of CSS is this, on line 905 in the style.css:

.wp-caption .wp-caption-text:before {
 color: #666;
 content: '\2014';
 font-size: 14px;
 font-style: normal;
 font-weight: bold;
 margin-right: 5px;
 position: absolute;
 left: 10px;
 top: 7px;

Removing chunk will stop the dash appearing. However, this change will be overwritten when you update your WordPress next. The best way to fix this would be to make a filter which applies to the wp_head() function to output:

.wp-caption .wp-caption-text:before {
  content: none;

The CSS content attribute appends some content to the selector.

Hashmask for WordPress plugin

Check me out being in the WordPress plugin directory!

I decided to add Hashmask as a plugin to the WordPress login form, mostly because I hated the problem that arc90 fixed. Wasn’t really that complicated, nor is it world stopping, but it’s totally my first submitted plugin!

Screenshot of Hashmask in WordPress
Screenshot of Hashmask in WordPress

Firefox 3.5b4: Storing data for offline use fuxxored.

Good idea, that doesn't work.
Good idea, that doesn't work.

For me at least anyway, and I’ve only tried it on two WordPress installations running bleeding edge 2.8. I get this message, click allow, and then all pages work once. Caching on the first load.

Then, if I refresh the page, or go back to it later, everything loads without the style sheet and JavaScript – the cached stuff. To fix it, I had to go into Options > Advance > Network and then remove my websites from the list.

I guess they’re for some reason competing with Google Gears, which makes little sense. Why compete? Why not just advertise Gears? They do exactly the same thing from what I can see.

Update: A lot of people are getting here to find out how to use Gears in the Firefox beta. You can use all your extensions (even if Firefox says they’re not compatible) by editing a single option. Of course, if you do that you could end up crashing Firefox or something, but you can just start in safe mode and disable it again.

  • Type about:config into Firefox’s address bar and click the “I’ll be careful, I promise!” button.
  • Right-click anywhere. Choose New>Boolean. Make the name of your new config value extensions.checkCompatibility and set it to false.
  • Make another new boolean pair called extensions.checkUpdateSecurity and set the value to false.
  • Restart Firefox.

WordPress contribution is not for the technically inept.

I’ve probably mentioned this before, but I love WordPress. It’s perfect for what it does. And even when you want it to do something it wasn’t made for, you can probably find an add on to make it (or at least hire a developer to make one for you).

When you need to make one you kinda run into problems though. The documentation is so damn iffy, and the support is fairly slow moving. The irc channel sucks. So, for the good of everyone, whenever I have spare time I’m going to do a bit on the documentation (which is in a wiki format). I can’t believe there are still some fairly common functions that’re used in WordPress that aren’t even covered yet.

A while ago the only support I could get was from a wiki page in French. Fortunately I could read it, but still. That’s just not good.

None of the code for WordPress is commented either, which I think is a really important thing within an open source project! You can’t get more developers if they can’t understand what your code is doing without rummaging through every include. It’s just not cool.