Posts from Monday, October 11th, 2010

A Textile Filter for BBEdit?

Published 13 years, 5 months past

A few days back I tweeted a request for a Textile filter for BBEdit, which is one of those things people have asked for over the years but has never actually appeared.  There’s been a Markdown filter since forever, but since I find myself on Basecamp a lot for business reasons and Basecamp uses Textile I’d really prefer to stick to one syntax instead of constantly confusing myself by switching between two similar syntaxes.

(And I prefer to use BBEdit because I like it a lot, know it well, and have no compelling reason to switch.  Please take any thoughts of text-editor snobbery or flamewars elsewhere.)

In response, the mighty Arlen Walker told me how to install Xcode, the Text::Textile module, and a short Perl script to drop into  ~/Library/Application Support/BBEdit/Unix Support/Unix Filters.  I did that, and it all worked, but I was unhappy with the <span class="caps"> that default Textile litters all over.  I tried to disable it, failed, tweeted for help, and was contacted by the incredible Brad Choate (who wrote the Text::Textile module!).

The upshot of all this is that Brad not only told me how to disable the spans, but how to convert Textile to a standalone BBEdit filter that, so far as I can tell, shouldn’t require installation of either Xcode or Text::Textile.  I’m pretty sure about this, but since I’ve already installed Text::Textile I can’t be entirely certain.  Who wants to test it out?

All you have to do is download TextileSA_pl.zip, unzip it, and drop the Perl script into ~/Library/Application Support/BBEdit/Unix Support/Unix Filters.  Once you do that, it should immediately become available in BBEdit, even if BBEdit is already running.  (At least that’s what happens in BBEdit 9.x.)  Here’s a test file to Texile-ize if you’re so inclined:

h1. Testing the BBEdit Textile filter

This is _awesome_!  "Arlen":http://theodicius.net/ and "Brad":http://bradchoate.com/ are the *bomb*.

There’s a bug at the moment that means double-quote marks don’t get smart-encoded, but Brad’s aware of it and plans to fix it.  Also, this does a straight Textile run with nothing disabled, so it will in fact still litter <span class="caps"> around any sequence of uppercase letters (like those in, say, “BBEdit”).  If you can’t stand that even during testing, open up TextileSA.pl and insert the following after line 2312:

my $css_flags = $textile->css();
$css_flags->{'class_caps'} = '';
$textile->css($css_flags);

If you don’t mind (or even like) those spans, then of course you can slip that part.

The “SA” in TextileSA.pl stands for “StandAlone”, by the way.  I’ll drop that once I’m sure this actually works and pass it along to the BBEdit gang.


Browse the Archive