Using Textmate and Markdown With Evernote: Configuring a Workflow


Fair warning: What follows is a rather nerdy means of getting text into Evernote. This isn’t for everyone. That said, if you’re looking for a way to write & preserve text that reaches beyond the standard Office suite, I highly recommend giving Textmate, Evernote, and Markdown a chance.

Preamble

I’ve recently moved to Evernote for much of my academic work: planning and maintaining courses, managing research projects, keeping advising notes, etc. I’ve traditionally used Dropbox, nvALT, and a simple folder structure for these purposes, but the power of Evernote’s web clipper prompted a reevaluation of the service. For example, I’m always searching for course materials: scholarship, tutorials, news stories, artifacts. Evernote has made the management of those materials much, much easier, as I don’t have to deal with particular file names or folder structures. New material is clipped to an Evernote “notebook” which then syncs across my devices. Perfect.

My problem with Evernote–and the reason I’ve moved away from it in the past–is the lack of plain text support. Evernote handles each text file as rich text. This causes a few concerns: Portability, file-type limitations (I can’t just add an HTML file and edit it in-line), and archiving. I’ve adjusted my personal workflow to deal with most of these concerns, save one: Markdown.

If you’re not familiar with Markdown, it’s a type of HTML shorthand. For example, rather than typing the full HTML structure for an unordered list, Markdown allows you to simply use asterisks to denote list items. (Profhacker has a nice intro to Markdown, if you’d like to learn more.) And with something like Fletcher Penney’s Multimarkdown, you can output Markdown in a number of ways. I’ve found Markdown endlessly helpful for academic writing and note taking: Once you understand the syntax, it’s much easier to write a structured document in Markdown than it is to deal with a rich text editor. With markdown I can focus on what I’m writing rather than navigating through an unwieldy interface for generating lists or headings or user styles. This post, in its original markdown, looks something like this:

But Evernote doesn’t support Markdown (because Evernote only offers rich, not plain, text as an option). So I’ve had to find a way to get the two to play together. I do this via Textmate.

Textmate is, in my opinion, the best text editor for the Mac. If you are using a Mac and you do anything at all with plain text, you should use Textmate. Why?

  • It’s truly light weight and very customizable
  • It’s (newly) open source and currently free
  • It is built around “bundles,” extension sets that add functionality for a particular language (HTML, CSS, Ruby, etc)
  • There’s a strong user base that is regularly contributing to and extending the project

I know many Mac nerds who prefer BBEdit or Sublime Text, but I’ve used Textmate for years, and I find that TextMate 2 (in development and linked below) is a good fit for my workflow. It’s a key component of my Markdown to Evernote routine.

So, how I’ve configured my Textmate to Evernote workflow:

The Ingredients:

  • Textmate 2
  • Multi-markdown
  • The Evernote-to-Markdown Script
  • The Evernote Mac Client

Step One: Install Multimarkdown

Multimarkdown is Fletcher Penney’s helpful revision of Markdown (which provides support for more complex HTML entities and output to formats like PDF), and this workflow requires his additions. As such, you need to download and install Multimarkdown. It’s a tiny file and has a built-in installer, so you can simply download and run the installer (let it install in the default location, which is–fyi–/usr/local/bin/multimarkdown). There’s much more you can do with Multimarkdown, but to get Markdown into Evernote we simply need Multimarkdown to live on your Mac.

Step Two: Configure Textmate 2

Next, download and install Textmate 2. I’ve linked to a compiled binary (although you can build the application yourself; more info about that on the Textmate Github Page), so you can simply download the app and drag it into your Applications folder. Opening Textmate will yield a window like this one:

A few things to note: The silver bar at the bottom of Textmate is the most important part of its interface. Clicking on the word “Plain Text” will show you a list of the installed “bundles”–or syntaxes that Textmate understands. (You can add more through the preferences menu.) Choose Markdown.

The tiny gear next to the syntax type will show a list of commands that Textmate can perform with a given syntax. So, for Markdown, Textmate can convert the document to HTML, show you a markdown cheatsheet, format lists, etc. The contents of my Markdown menu:

Each of those commands is a part of the markdown “bundle.” If we want to include additional Textmate commands, we need to add them to the bundle. Luckily, Brett Terpstra and Martin Kopischke have done the difficult work of creating a Markdown-to-Evernote Mac service that also works as a Textmate command.

Step Three: Install Markdown2Evernote

Martin has posted the source of his service on Github, so head to github, click on the “view raw” button, and select all (command+a) and copy (command+c) the entire script.

Next, jump back into Textmate. Click on the “Bundles” menu, and choose “Edit Bundles.” Textmate 2’s bundle editor still needs some work, so don’t be scared, but our work here will be quick & simple.

Select the “Markdown” bundle and select “Menu Actions”:

Then, press Command+N to make a new command (and be sure to select “command” from the drop down menu). After you press enter, a drawer will slide from the right side of the menu. You should be concerned with three fields: Check the box to “Enable this item,” name it “Markdown2Evernote,” and give it a scope selector of “text.html.markdown”. Then, in the text area below the bundle navigation, paste the ruby script that you copied from github:

You will now have a Markdown2Evernote Textmate Action.

Step Four: Write and Export

At this point, you can simply create a markdown document, add your markdown text, and then click the Markdown2Evernote command in Textmate. Textmate will convert your markdown to rich text and place the file in your default Evernote notebook.

The script also includes metadata functionality, so you can add a note title, destination notebook, and tags. (Multimarkdown metadata must begin on the first line and ends with the first blank line.) The script will then title & tag the note appropriately and drop it into the proper notebook:

Caveats

Because Evernote doesn’t support plain text, there isn’t a way to convert the note back to Markdown. This is a one-way workflow. I’m not bothered by this, as my goal is to write in Markdown, not to preserve my document in Markdown (I see Markdown as a simple way to get to another file type). It’s easy enough to my get my data out of Evernote, so I’m not (at the moment) too worried about preservation issues. And an appeal of Evernote is the centralized location of notes, so I’m interested in this workflow because it frees me to write in Textmate while storing materials in an easily accessible & searchable personal database.

While you could turn the Markdown2Evernote script into a Mac service (which would allow you to use other text editors), I think the bundle actions make Textmate the best fit for the workflow. For example, within the bundle editor you can bind the Markdown2Evernote command to a keyboard shortcut–further simplifying the workflow.

Markdown isn’t for everyone, but I think its structural system is a good fit for most academic writing and note taking. Each part of this workflow is free and open source, so I’d encourage you to give it a try.

I will write another post about how I’m specifically using Evernote to plan for class and collect preliminary research materials. And if anything isn’t clear, please let me know on the comments or via Twitter.

« Changing the Display of Git Log On Ebert »

Comments