Naked em dashes

I can’t stand it when a phrase set off in em dashes—like this—gets broken such that a line of text begins with an em dash. I’m not sure if that’s a recognized typographical sin or just my own pet peeve; either way, I use a lot of em dashes, so I decided to fix the problem.

In WordPress, you can add this bit to your functions.php file:

The code uses <span> tags to bind every em dash to the preceding word so that none may ever stab nakedly to the left. Something very similar will work in just about any CMS; the regex is the key.

January 2016, Berkeley

Really, the main thing to do here is sign up for my email newsletter. I try to make it feel like a note from a friend, and it's very easy to unsubscribe. Plus, there are occasionally… secrets