TextMate News

Anything vaguely related to TextMate and macOS.

Customized Command Output

TextMate commands can have their output shown as HTML. This is useful for commands which by nature generate HTML, like visualizing the HTML resulting from the simpler markup that some of us prefer to work in.

The feature is also used by many other commands, for example script-runners, build commands, and many version control commands get nice rich output by harvesting the features of WebKit.

Initially there was much inconsistency between how the command’s output looked, since each was basically generating its own HTML page. But Stanley Rost added a function (usable by the commands) to get a standard header with appropriate style sheet. It was later improved to have a pop-up to change the style sheet, mainly done so that users of “bright on dark” editing themes can have command output that match in contrast.

By default there are four themes to pick from but it is possible to create your own theme and recently I came across the Virtuoso theme, which as far as I know is the first third-party command-output theme :)

The way theme-switching presently works is by assigning a class name to a top-level div tag. This class name is that of the theme, and each theme thus needs to target only elements under this class. This will however shortly be improved so that the actual style sheet is swapped, rather than just the class name (so that theme authors do not need to clutter their themes with class selectors).

categories General