Advertisement

Use Markdown Anywhere, on a Mac, With Markdown Service Tools

by

In a previous tutorial, I showed you how to get started with Markdown on OS X. In the tutorial I highlighted a few applications, such as Byword, that let you use Markdown on a Mac. 

Markdown is excellent but copying and pasting Markdown text between different applications is far from the most efficient way to use it. 

In this tutorial, I’ll focus on how you can write in Markdown anywhere on a Mac, rather than just in specific apps, by using Brett Terpstra’s Markdown Service Tools.

Markdown Refresher

Markdown is a simple formatting syntax that you can use to write plain text that is convertible into HTML or RTF. 

It makes it super easy to do things like create headers, emphasise text, include links and create bulleted lists without having to resort to highlighting text and selecting formats from menus. 

The full syntax only takes half an hour to learn. Check out the earlier tutorial introducing Markdown for a full description.

Some of the most commonly used Markdown features.

OS X Services

My colleague, Jacob, gives a great introduction in his tutorial using Services to automate tasks. In essence, Services allow you to extend the functionality of an application by providing a means for it to connect to other applications. 

In the case of the Markdown Service Tools, text is processed using Automator. Services can be accessed in a few different ways. The easiest for any Service that acts on text is to highlight the relevant text and two-finger click on it. 

From the contextual menu hover over the Services option and select the Service you want to use. You can also access the Services menu by clicking on the app name in the menubar and choosing Services.

Introducing Markdown Service Tools

Brett Terpstra is an OS X developer who is responsible for many of the most popular OS X Markdown tools–two of his projects, nvALT 2 and Marked 2, were featured in the previous tutorial. The Markdown Service Tools are one of his most powerful developments as they let you use Markdown in almost all Mac applications.

The Markdown Service Tools are a collection of 33 Automator Workflows that perform a range of Markdown operations. Some are simple but incredibly useful, such as converting the selected text from Markdown to HTML, or vice versa, while others are more complex such as pulling all the URLs from the foreground Chrome or Safari window and creating a reference list of URLs. 

The 33 Services are divided into nine different categories to make them easy to find. 

In this tutorial I’m focussing on the specific Services that let you use Markdown anywhere on your Mac, but if you are interested in maximising Markdown’s awesomeness you should play around with the full set.

Setting Up Markdown Service Tools

The Markdown Service Tools are installed like any other OS X Service.

  • Download the Markdown Service Tools .zip file.
  • In the Downloads folder, double-click on the .zip file to unarchive it.
  • You need to add the files in the resulting folder to your [UserFolder]/Library/Services folder. By default, the Library folder is hidden. The easiest way to access it is to use the Terminal, so open Terminal from the Applications folder.
  • Copy and paste cd ~/Library/Services into Terminal and press Return. cd is the command to change directory and ~ represents the User folder.
  • Copy and paste open . in and again press Return. The Services folder will open in a new Finder window.
  • Drag the Markdown Service Tools files into the Services folder.
The Markdown Service Tools in my Library/Services folder.

The Markdown Service Tools are installed and now appear in the Services menu when they are able to be used. 

This, however, would not be a Tuts+ tutorial if I didn’t show you how to improve things by adding keyboard shortcuts. You can manage your Services using System Preferences but the better way to do it is to use the free tool Services Manager.

With Services Manager you can control what Services are active on the system, whether or not they appear in the contextual menu, and assign them keyboard shortcuts.

  • Download the Services Manager .zip file.
  • Double-click on the .zip file in the Downloads folder to extract the .pkg file.
  • Double-click on the .pkg file to run the Services Manager installer.
  • Open Services Manager from the Applications/Utilities folder.

The Markdown Service Tool Services are all named md – [Category] – [Service]. This makes them easy to find in the Services menu; all the Markdown Service Tools are grouped together and all the similar actions are further grouped within. 

To decide whether a Service is active or appears in the contextual menu check, or uncheck, the relevant check box next to it. 

To add a keyboard shortcut to a Service, double-click on the Key column next to it and enter the keyboard shortcut you want to use. In the next section I’ll recommend keyboard shortcuts for the two most useful Services.

Using the Services Manager to add keyboard shortcuts.

Writing Markdown Anywhere

All the Markdown Service Tools have a use, however, you will obviously find yourself using some more than others. The ones you are most likely to use the most are all the Convert Services

These are the Services that let you write Markdown anywhere on your Mac and then convert the text to HTML or RTF in place. You can find a full description of what each Service does on Brett’s site.

md – Convert – MultiMarkdown to HTML and md – Convert – MultiMarkdown to RTF are the two Services you will use most. 

These two Services let you use Markdown where otherwise you couldn’t. For example, you can respond to an email using Markdown and then convert the text to RTF or HTML so whoever you are emailing can read it properly. 

Writing an email in Markdown.

Both Services replace the Markdown text with the exported text so you don’t need to do any copy and pasting. 

The same email after the text is converted from Markdown to RTF.

I use Services Manager to assign them the keyboard shortcuts Command-Option-Shift-H and Command-Option-Shift-R respectively.

Conclusion

In this tutorial I’ve shown how to install, set up and use Brett Terpstra’s Markdown Service Tools to write Markdown anywhere on your Mac. 

Markdown makes it really easy to include common formatting features like headers, emphasis, links and lists that would otherwise involve selecting sections of text and choosing options from dropdown menus.

If you’ve any great Markdown tips or tricks–or a favourite Markdown service–please let me know in the comments.

Advertisement