Italicise Markdown in TextWrangler

I use TextWranglerhttp://www.barebones.com/products/textwrangle… as my main editor, and I use the Text Filter menu a lot. Here is a filter for italicising text in Markdownhttps://www.gitbook.com/book/gitbookio/markdo…, which means adding asterisks around text, like this:

The text here is not italic. *The text will be.* And this text isn't.

When put through a Markdown parser it renders like this:

The text here is not italic. The text will be. And this text isn’t.

It’s a pretty straightforward piece of code:

#! /usr/bin/env ruby
# encoding: UTF-8

print '*' << ARGF.readlines.join << '*'

and, using the preferences for Menus and Shortcuts, I bind it to the cmd + I key combo (Apple and “I”, as it would be in apps like TextEdit). Just drop it in ~/Library/Application Support/TextWrangler/Text Filters to use.

Wrapping bits of text is a fairly frequent use for a text filter, and this is a nice simple start. In the next article of this series I’ll give a more complex example so you’ll have 2 different filters to look at for building your own from, or you can just use mine, I’ll keep adding them to my Github repo.

Added on:
Last updated:
Info:Ruby v2.2.2p95 TextWrangle 4