SmartyPants On Demand

Of course you’ve heard of SmartyPants, right? It’s that famous Movable Type and Blosxom plugin enabling authors to publish their weblogs with typographically elegant punctuations. That includes the famous Doug Bowman’s Stopdesign.

Unfortunately for WordPress users, those wanting to use it had little chance, with SmartyPants written in Perl, not in PHP. Not until Michel Fortin came out with PHP SmartyPants, a PHP port of the original written by John Gruber. However, his plugin implementation was all–or–nothing—use SmartyPants for all text in entries and comments, replacing Matt’s texturize(), native in the WP codebase.

This is where SmartyPants On Demand comes in. My latest plugin allows WP publishers to use SmartyPants only when needed. But why not use SmartyPants all the time? My unscientific testing shows that it is slower than texturize(), by as much as 20% in some situations.

Drop the plugin file in your plugins/ folder and activate. To apply it to an entry, just add a custom field named smartypants-on-demand with a value of 1.

6 Responses

  4. Markku, you are awesome. Thanks for working on this. Oddly enough I was just thinking about the lack of Smartypants support in WordPress.

    Smartypants was (and still is) one of my favorite text massagers for Movable Type and I sorely missed it when I moved from MT to WP.

    Your work is commended.

    On a site note, where did you get the code to dynamically ‘decrease’ and ‘increase’ the text area?

  5. Erik, thanks for that, I hope you enjoy the plugin.

    The increase/decrease textarea feature is from Dunstan, I just asked for it. A lot of other bloggers are using it now, btw.

Leave a Reply