« Snap! Talk to the hand. | Main | Pool in the Spree »
October 08, 2004
Using Textile with HumaneText Service for OSX
Textile is a fantastic thing, which makes writing valid XHTML quick, easy and reliable. It converts text from an easy-to-learn syntax to valid XHTML automatically. It also correctly formats ampersands and copyright symbols, even tables and lots more, freeing you from needing to memorize all those character codes. (If you’re using MovableType, install the plugin and don’t look back.)
Now, I’ve also recently started realizing how amazing OSX’s Services menu is. For example, did you know the system-wide keyboard shortcut Shift-Apple-Y? It makes a new Sticky note from any selected text. Quite useful for keeping URLs and email addresses around.
To me, one of the most useful of all Services is HumaneText.service, which lets you convert text to HTML and vice versa in any text you write anywhere in OS X—any textfield on any webpage you have open in Safari, any text you’re writing in your text editor, even in Word—can be immediately converted to valid XHTML. Maybe it’s just because I learned Textile first, but I prefer Textile over John Gruber’s similar Markdown format. Unfortunately, HumaneText.service doesn’t support Textile by default.
If you prefer Markdown format, you can download and install the HumaneText service in a minute or two and be done with it. It does also support Textile; the correct file’s installed along with HumaneText. But it’s not obvious how to make it do so. The download page says vaguely that you can “change a symlink to use your favourite script.”
I couldn’t find instructions on how to do this for Unix laypeople like me, so here’s what I figured out instead of watching the presidential debate this evening. (These instructions also correct a minor but crucial omission in the Textile code that’s installed with HumaneText.) You’ll need a text editor and some minor confidence with the Unix command line, but the changes you’ll make are very easy and safe. It’s a simple 13-step process!
Note: after any step below that tells you to type some text, hit the Return key after you type the text.
1. Download and install HumaneText
2. Locate the file ~/Library/Services/HumaneText.service
3. Right-click on HumaneText.service and choose “Show Package Contents”.
4. Navigate this new window to find Contents/Resources/textile.py.
5. Open textile.py in any text editor (not Microsoft Word). Apple’s TextEdit program works fine.
6. Add the text following as the very first line in textile.py: #!/usr/bin/env python
7. Save and close textile.py
8. Open the Terminal application.
9. Type cd ~/Library/Services/HumaneText.service/Contents/Resources/
10. (optional) If you want to see the files in this directory, type ls -l
11. Type rm forward
12. Type ln -s textile.py forward
13. Type the word exit to close your Terminal session.
You’re all set. Open a new Sticky note and type h1. Textile. Select what you just typed and choose the menu item Stickies>Convert Humane Text>Text to XHTML. Your text should be converted to XHTML tags. Try some of the other Textile syntax too.
Posted by Andrew at October 8, 2004 08:43 PM
Trackback Pings
TrackBack URL for this entry:
http://www.heyotwell.com/cgi-bin/mt/mt-tb.cgi/43
Comments
Awesome, I always wondered how to switch this - I think the part I missed before was adding the python line to the top of textile.py - DOH!.
Thanks again.
Posted by: Shawn at January 7, 2005 03:01 PM
Yes, it's really odd that the copy of textile.py that's included with Humane Text Services needs to be changed like this.
Posted by: heyotwell
at January 7, 2005 03:15 PM