A Quick Look Plugin for txt2tags
07 December 2008
Txt2tags is a lightweight markup language that can be converted into many different formats. I have been experimenting with it as a way of simplifying this site since I am uncomfortable with the idea that all of my content is stored in a remote database in some unknown format. I'll describe more about my experiences converting this site to txt2tags in future blogs; in this blog I thought I would share a Quick Look plugin I wrote to make txt2tags seem like less of an outsider on OS X.
Quick Look is a feature in Mac OS X Leopard that lets you quickly view
the contents of a file in the Finder by pressing the space bar. Since
the Finder did not recognize the
t2t extension, it did not know
how to display the file. While I did not find a Quick Look plugin for
txt2tags, I did find such a
plugin for Markdown,
another lightweight markup language. The author also put the source up,
so I downloaded it and saw that a few simple changes could make this
plugin work for txt2tags.
It was relatively simple to get the plugin working. I made a new Quick
Look plugin project in XCode and modified some of the functions in the
Markdown plugin to call txt2tags instead. I then compiled the plugin
and installed it in
~/Library/QuickLook. After some fussing with
input arguments to txt2tags and the
Info.plist file, it worked - I
could now get a preview of the txt2tags via Quick Look. As an example,
below is a txt2tags input file and the Quick Look preview.
**A txt2tags sample** This simple file shows how [txt2tags http://txt2tags.sourceforge.net/] can generate valid HTML from lightweight markup. Some advantages of txt2tags for simple web sites include: - Style is separated from content - All content is stored in a simple and readable format - The site is backed up with the rest of your files
A great project (for someone else), would be to make a single Quick Look plugin for a variety of lightweight markup languages. The plugin could determine which HTML generator to call based on extension. It wouldn’t be a hard programming project, just slightly time consuming since there are quite a few of these languages. Until someone makes such a plugin, you can use this plugin, which only works with txt2tags, or the Markdown plugin mentioned above.