Using Alfred and qlmarkdown to Quicklook .md files in macOS

I have been using Alfred more and more during the past months and I’ve been looking for a quick way to view little snippets of information with it. I use a few ‘cheat sheets’ for commands and application I use where I’m not always sure of the right command or syntax.

Cheat sheets

I have been creating very simple .md markdown sheets for a few command’s I use a lot. We will use the Atlassin text syntax as an example. I created the following markdown file:

- `*strong*`	→ 	Makes text strong.
- `_emphasis_`	→ 	Makes text emphasis..
- `??citation??`	→	Makes text in citation.
- `-deleted-`	→ 	Makes text as deleted.
- `+inserted+`	→ 	Makes text as inserted.
- `^superscript^`	→ 	Makes text in superscript.
- `~subscript~`	→ 	Makes text in subscript.
- `` →	Makes text as monospaced.

Putting text in red
{color:red}
    look ma, red text!
{color}

Previewing .md files on macOS

To preview a markdown file on macOS with rendering you’ll need to install qlmarkdown. When installed this will enable the build in macOS Quicklook to render markdown files in the preview window.

Calling Cheat Sheets using Alfred

Using an Alfred ‘File Filter’ + ‘Run Script’ action you can easily list files in a directory. The Run Script action will then perform the command-line version of Quicklook on the file using the following command:

qlmanage -p $query 

Setting up the workflow in Alfred will look like this:

  1. The Workflow in Alfred
    Alfred Workflow

  2. Settings for the File Filter, drag the folder you want to look in into the option scope
    File Filter

  3. Settings for the Run Script
    Run Script Settings

Putting it all together

Once this is all set-up you can easily create simple markdown cheat sheets and call them using Alfred


Found this useful? Consider sponsoring me or buying me a cup of coffee at KoFi